Skip to content

Commit

Permalink
fix proposal builder, fix block party wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
Fraccaman committed May 28, 2024
1 parent acd5f95 commit ba3ab4a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 28 deletions.
19 changes: 0 additions & 19 deletions block_party/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,9 @@ use std::str::FromStr;

use namada_proof_of_stake::storage::{read_pos_params, write_pos_params};

const TX_UPDATE_ACCOUNT_NAME: &str = "tx_update_account.wasm";
const TX_UPDATE_ACCOUNT_BYTES: &[u8] = include_bytes!("../../wasms/tx_update_account.04256c4087de46e71e6f323b696ec412e41cfd3ec337010c1f2a590037c0cf8c.wasm");

const TX_INIT_ACCOUNT_NAME: &str = "tx_init_account.wasm";
const TX_INIT_ACCOUNT_BYTES: &[u8] = include_bytes!("../../wasms/tx_init_account.4078c07a356691b23049055df6fc7fb99c32b75f488f435538c1a960cdb41153.wasm");

const TX_CLAIM_REWARDS_NAME: &str = "tx_claim_rewards.wasm";
const TX_CLAIM_REWARDS_BYTES: &[u8] = include_bytes!("../../wasms/tx_claim_rewards.af4cd35b30f17cf2440be74bedeb74296aac21e4ab1ea7143f3a3dede722a0ed.wasm");

const TX_UPDATE_STEWARD_COMMISSION_NAME: &str = "tx_update_steward_commission.wasm";
const TX_UPDATE_STEWARD_COMMISSION_BYTES: &[u8] = include_bytes!("../../wasms/tx_update_steward_commission.01e2395fab96f0ac8251329370149144159d378abcf5a414df1c030a329bda82.wasm");

const TX_RESIGN_STEWARD_NAME: &str = "tx_resign_steward.wasm";
const TX_RESIGN_STEWARD_BYTES: &[u8] = include_bytes!("../../wasms/tx_resign_steward.b5dbddb91e2627d400fa6ca83970a8396dd968ab25ff896b845b19a813729e04.wasm");

#[transaction(gas = 10000)]
fn apply_tx(ctx: &mut Ctx, _tx_data: BatchedTx) -> TxResult {
// PoS inflation
Expand Down Expand Up @@ -50,14 +38,7 @@ fn apply_tx(ctx: &mut Ctx, _tx_data: BatchedTx) -> TxResult {

// Update the allowlist and write the addition wasm storage keys per transaction
for (wasm_name, wasm_bytes) in [
(TX_UPDATE_ACCOUNT_NAME, TX_UPDATE_ACCOUNT_BYTES),
(TX_INIT_ACCOUNT_NAME, TX_INIT_ACCOUNT_BYTES),
(TX_CLAIM_REWARDS_NAME, TX_CLAIM_REWARDS_BYTES),
(
TX_UPDATE_STEWARD_COMMISSION_NAME,
TX_UPDATE_STEWARD_COMMISSION_BYTES,
),
(TX_RESIGN_STEWARD_NAME, TX_RESIGN_STEWARD_BYTES),
] {
let tx_hash = CodeHash::sha256(wasm_bytes);

Expand Down
10 changes: 5 additions & 5 deletions builder/build_proposal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import json
import os


GOVERNANCE_GENESIS_PARAMETERS = {
"max_proposal_code_size": 300000,
"min_proposal_voting_period": 3,
Expand All @@ -13,10 +14,11 @@
"max_proposal_latency": 30
}


def validate_data(data: Dict[str, str]) -> bool:
start_epoch = data['voting_start_epoch']
end_epoch = data['voting_end_epoch']
activation_epoch = data['grace_epoch']
activation_epoch = data['activation_epoch']
proposal_content = len(json.dumps(data))
wasm_size = os.path.getsize(data['wasm_path']) / 1024 # in kibibytes

Expand All @@ -42,8 +44,6 @@ def validate_data(data: Dict[str, str]) -> bool:

return True



def build_proposal(
content: Dict[str, str],
author: str,
Expand All @@ -57,7 +57,7 @@ def build_proposal(
"author": author,
"voting_start_epoch": start_epoch,
"voting_end_epoch": end_epoch,
"grace_epoch": activation_epoch
"activation_epoch": activation_epoch
},
"data": list(open(data_path, "rb").read())
}
Expand Down Expand Up @@ -109,7 +109,7 @@ def main(data_path: str, output_path: str):
data["author"],
data["voting_start_epoch"],
data["voting_end_epoch"],
data["grace_epoch"],
data["activation_epoch"],
data["wasm_path"],
)

Expand Down
8 changes: 4 additions & 4 deletions builder/parameters/block-party.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"motivation": " Vivamus eget ex id erat interdum dictum vel ac libero.",
"details": "Phasellus quis sem finibus, luctus neque in, vestibulum lectus.",
"requires": "-1",
"author": "author",
"voting_start_epoch": 5,
"voting_end_epoch": 10,
"grace_epoch": 12,
"author": "tnam1qxfj3sf6a0meahdu9t6znp05g8zx4dkjtgyn9gfu",
"voting_start_epoch": 189,
"voting_end_epoch": 201,
"activation_epoch": 205,
"wasm_path": "artifacts/block_party.wasm"
}

0 comments on commit ba3ab4a

Please sign in to comment.