Skip to content

Commit

Permalink
Add set revision to 1 code and fix failing blocknum_onchain (old live…
Browse files Browse the repository at this point in the history
…_test_runner test bed)
  • Loading branch information
guilledk committed Nov 29, 2024
1 parent dcd77fb commit 12442ae
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
9 changes: 8 additions & 1 deletion crates/telos/node/tests/integration_lite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use antelope::name;
use antelope::chain::name::Name;

pub mod utils;
use crate::utils::cleos_evm::{EOSIO_ADDR, EOSIO_PKEY, EOSIO_WALLET, get_nonce, multi_raw_eth_tx, sign_native_tx};
use crate::utils::cleos_evm::{EOSIO_ADDR, EOSIO_PKEY, EOSIO_SIGNER, EOSIO_WALLET, get_nonce, multi_raw_eth_tx, setrevision_tx, sign_native_tx};
use crate::utils::runners::{build_consensus_and_translator, CONTAINER_LAST_EVM_BLOCK_LITE, CONTAINER_NAME_LITE, CONTAINER_TAG_LITE, init_reth, start_ship, TelosRethNodeHandle};

use alloy_provider::{Identity, Provider, ProviderBuilder, ReqwestProvider};
Expand Down Expand Up @@ -148,6 +148,13 @@ pub async fn run_tests(
Address::from_hex("0000000000000000deadbeef0000000000000000").unwrap()
).await;

// set revision to 1
let info = telos_client.v1_chain.get_info().await.unwrap();
let eosio_key = PrivateKey::from_str(EOSIO_PKEY, false).unwrap();
let unsigned_rev_tx = setrevision_tx(&info, 1);
let rev_tx = sign_native_tx(&unsigned_rev_tx, &info, &eosio_key);
telos_client.v1_chain.send_transaction(rev_tx).await.unwrap();

test_blocknum_onchain(reth_provider).await;
}

Expand Down
28 changes: 28 additions & 0 deletions crates/telos/node/tests/utils/cleos_evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,34 @@ pub async fn get_nonce(client: &APIClient<DefaultProvider>, address: &Address) -
account.nonce
}

#[allow(dead_code)]
pub fn setrevision_tx(
info: &GetInfoResponse,
new_revision: u32
) -> Transaction {
#[derive(Clone, Eq, PartialEq, Default, StructPacker)]
struct SetRevision {
new_revision: u32,
}

let raw_data = SetRevision {
new_revision
};
let rev_act = Action::new_ex(
name!("eosio.evm"),
name!("setrevision"),
vec![PermissionLevel::new(name!("eosio.evm"), name!("active"))],
raw_data,
);

Transaction {
header: info.get_transaction_header(90),
context_free_actions: vec![],
actions: vec![rev_act],
extension: vec![],
}
}

#[allow(dead_code)]
pub async fn raw_eth_tx(
info: &GetInfoResponse,
Expand Down

0 comments on commit 12442ae

Please sign in to comment.