Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge working changes to telos-main #25

Closed
wants to merge 9 commits into from
31 changes: 6 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ revm-inspectors = { git = "https://github.com/telosnetwork/telos-evm-inspectors"

# eth
alloy-chains = { version = "0.1", feature = ["serde", "rlp", "arbitrary"] }
alloy-primitives = "0.6"
alloy-primitives = { version = "0.6", feature = ["serde"] }
alloy-dyn-abi = "0.6"
alloy-sol-types = "0.6"
alloy-rlp = "0.3"
alloy-trie = "0.3"
alloy-trie = "=0.3.0"
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "76c70fb" }
alloy-rpc-trace-types = { git = "https://github.com/alloy-rs/alloy", rev = "76c70fb" }
alloy-rpc-engine-types = { git = "https://github.com/alloy-rs/alloy", rev = "76c70fb" }
Expand Down
2 changes: 1 addition & 1 deletion crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ sha2 = "0.10.7"
sucds = "~0.6"
tempfile.workspace = true
thiserror.workspace = true
zstd = { version = "0.12", features = ["experimental"] }
zstd = { version = "=0.13.0", features = ["experimental"] }
cfg-if = "1.0.0"

# `test-utils` feature
Expand Down
8 changes: 4 additions & 4 deletions crates/primitives/res/genesis/tevmmainnet_base.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"nonce": "0x0",
"timestamp": "0x61782354",
"extraData": "0x0ac53eebcfa1cf139272bf58540d6dc53f0d22785f9e3d74cb9bc333b597e1bf",
"extraData": "0x0ac53eeca101095f48c7b6d65d0130e566903894f7a6b9d50cf1e144ca020f38",
"gasLimit": "0x7fffffff",
"difficulty": "0x0",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"stateRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"number": "0xac53ec7",
"number": "0xac53ec8",
"gasUsed": "0x0",
"parentHash": "0x87bb009caefe5447b3c4beafb6cc168d031a73eb9c6bb0718b5b5972448908c2"
}
"parentHash": "0x757720a8e51c63ef1d4f907d6569dacaa965e91c2661345902de18af11f81063"
}
24 changes: 12 additions & 12 deletions crates/primitives/src/chain/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,20 +230,20 @@ pub static TEVMMAINNET_BASE: Lazy<Arc<ChainSpec>> = Lazy::new(|| {
genesis: serde_json::from_str(include_str!("../../res/genesis/tevmmainnet_base.json"))
.expect("Can't deserialize Tevmmainnet-base genesis json"),
genesis_hash: Some(b256!(
"757720a8e51c63ef1d4f907d6569dacaa965e91c2661345902de18af11f81063"
"ed58397aca4c7ce2117fae8093bdced8f01d47855a46bb5ad6e4df4a93e8ee27"
)),
hardforks: BTreeMap::from([
(Hardfork::Frontier, ForkCondition::Block(180698823)),
(Hardfork::Homestead, ForkCondition::Block(180698823)),
(Hardfork::Dao, ForkCondition::Block(180698823)),
(Hardfork::Tangerine, ForkCondition::Block(180698823)),
(Hardfork::SpuriousDragon, ForkCondition::Block(180698823)),
(Hardfork::Byzantium, ForkCondition::Block(180698823)),
(Hardfork::Constantinople, ForkCondition::Block(180698823)),
(Hardfork::Petersburg, ForkCondition::Block(180698823)),
(Hardfork::Istanbul, ForkCondition::Block(180698823)),
(Hardfork::MuirGlacier, ForkCondition::Block(180698823)),
(Hardfork::Berlin, ForkCondition::Block(180698823)),
(Hardfork::Frontier, ForkCondition::Block(180698824)),
(Hardfork::Homestead, ForkCondition::Block(180698824)),
(Hardfork::Dao, ForkCondition::Block(180698824)),
(Hardfork::Tangerine, ForkCondition::Block(180698824)),
(Hardfork::SpuriousDragon, ForkCondition::Block(180698824)),
(Hardfork::Byzantium, ForkCondition::Block(180698824)),
(Hardfork::Constantinople, ForkCondition::Block(180698824)),
(Hardfork::Petersburg, ForkCondition::Block(180698824)),
(Hardfork::Istanbul, ForkCondition::Block(180698824)),
(Hardfork::MuirGlacier, ForkCondition::Block(180698824)),
(Hardfork::Berlin, ForkCondition::Block(180698824)),
]),
..Default::default()
}
Expand Down
74 changes: 72 additions & 2 deletions crates/primitives/src/revm/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,79 @@ pub fn fill_tx_env_with_beacon_root_contract_call(env: &mut Env, parent_beacon_b
#[cfg(feature = "telos")]
first_new_address: None,
#[cfg(feature = "telos")]
revision_number: 0,
fixed_gas_price: if env.block.number < U256::from(255838760_u64) {
U256::from(499809179185_u64)
} else if env.block.number < U256::from(256919102_u64) {
U256::from(503604564858_u64)
} else if env.block.number < U256::from(258567748_u64) {
U256::from(503624212149_u64)
} else if env.block.number < U256::from(260508029_u64) {
U256::from(503659916170_u64)
} else if env.block.number < U256::from(261916623_u64) {
U256::from(503692840132_u64)
} else if env.block.number < U256::from(263258684_u64) {
U256::from(503730067379_u64)
} else if env.block.number < U256::from(265110408_u64) {
U256::from(503766558895_u64)
} else if env.block.number < U256::from(266854672_u64) {
U256::from(503847329123_u64)
} else if env.block.number < U256::from(271693305_u64) {
U256::from(503937085418_u64)
} else if env.block.number < U256::from(277570654_u64) {
U256::from(504169102143_u64)
} else if env.block.number < U256::from(281052225_u64) {
U256::from(504588007093_u64)
} else if env.block.number < U256::from(282427274_u64) {
U256::from(504730060459_u64)
} else if env.block.number < U256::from(286905983_u64) {
U256::from(504777487548_u64)
} else if env.block.number < U256::from(290533301_u64) {
U256::from(504901632992_u64)
} else if env.block.number < U256::from(296069390_u64) {
U256::from(505018605664_u64)
} else if env.block.number < U256::from(300562146_u64) {
U256::from(505225116066_u64)
} else if env.block.number < U256::from(307967043_u64) {
U256::from(505764887222_u64)
} else if env.block.number < U256::from(309157097_u64) {
U256::from(507293569984_u64)
} else if env.block.number < U256::from(312517437_u64) {
U256::from(507611802460_u64)
} else if env.block.number < U256::from(314907931_u64) {
U256::from(508508333703_u64)
} else if env.block.number < U256::from(319569825_u64) {
U256::from(509215569036_u64)
} else if env.block.number < U256::from(323391709_u64) {
U256::from(510837337450_u64)
} else if env.block.number < U256::from(324360809_u64) {
U256::from(511832996910_u64)
} else if env.block.number < U256::from(324398028_u64) {
U256::from(512009459358_u64)
} else if env.block.number < U256::from(325597355_u64) {
U256::from(512023715983_u64)
} else if env.block.number < U256::from(329239018_u64) {
U256::from(512509489520_u64)
} else if env.block.number < U256::from(329714374_u64) {
U256::from(513753813459_u64)
} else if env.block.number < U256::from(332358496_u64) {
U256::from(513889289168_u64)
} else if env.block.number < U256::from(334211846_u64) {
U256::from(514927973622_u64)
} else if env.block.number < U256::from(338022602_u64) {
U256::from(515474978733_u64)
} else if env.block.number < U256::from(339221402_u64) {
U256::from(516125417219_u64)
} else if env.block.number < U256::from(344908827_u64) {
U256::from(516282803626_u64)
} else {
U256::from(516900477336_u64)
},
#[cfg(feature = "telos")]
fixed_gas_price: U256::ZERO,
revision_number: if env.block.number < U256::from(332317496_u64) {
0
} else {
1
},
};

// ensure the block gas limit is >= the tx
Expand Down
74 changes: 72 additions & 2 deletions crates/revm/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ where
// #[cfg(feature = "telos")]
// let mut gasprice_changes_iter = gasprice_changes.as_ref().unwrap().into_iter().peekable();
#[cfg(feature = "telos")]
let mut new_addresses_using_create_iter = new_addresses_using_create.as_ref().unwrap().into_iter().peekable();
let mut new_addresses_using_create_iter = new_addresses_using_create.unwrap_or_default().into_iter().peekable();
// #[cfg(feature = "telos")]
// if revision_changes.as_ref().is_none() || revision_changes.as_ref().unwrap().len() == 0 {
// return Err(BlockExecutionError::ProviderError)
Expand Down Expand Up @@ -567,7 +567,77 @@ where
.into())
}
// Execute transaction.
let ResultAndState { result, state } = self.transact(transaction, *sender, #[cfg(feature = "telos")] 0, #[cfg(feature = "telos")] U256::from_str("499809179185").unwrap())?;
let ResultAndState { result, state } = self.transact(transaction, *sender, #[cfg(feature = "telos")] if block.number < 332317496 {
0
} else {
1
}, #[cfg(feature = "telos")] if block.number < 255838760 {
U256::from(499809179185_u64)
} else if block.number < 256919102 {
U256::from(503604564858_u64)
} else if block.number < 258567748 {
U256::from(503624212149_u64)
} else if block.number < 260508029 {
U256::from(503659916170_u64)
} else if block.number < 261916623 {
U256::from(503692840132_u64)
} else if block.number < 263258684 {
U256::from(503730067379_u64)
} else if block.number < 265110408 {
U256::from(503766558895_u64)
} else if block.number < 266854672 {
U256::from(503847329123_u64)
} else if block.number < 271693305 {
U256::from(503937085418_u64)
} else if block.number < 277570654 {
U256::from(504169102143_u64)
} else if block.number < 281052225 {
U256::from(504588007093_u64)
} else if block.number < 282427274 {
U256::from(504730060459_u64)
} else if block.number < 286905983 {
U256::from(504777487548_u64)
} else if block.number < 290533301 {
U256::from(504901632992_u64)
} else if block.number < 296069390 {
U256::from(505018605664_u64)
} else if block.number < 300562146 {
U256::from(505225116066_u64)
} else if block.number < 307967043 {
U256::from(505764887222_u64)
} else if block.number < 309157097 {
U256::from(507293569984_u64)
} else if block.number < 312517437 {
U256::from(507611802460_u64)
} else if block.number < 314907931 {
U256::from(508508333703_u64)
} else if block.number < 319569825 {
U256::from(509215569036_u64)
} else if block.number < 323391709 {
U256::from(510837337450_u64)
} else if block.number < 324360809 {
U256::from(511832996910_u64)
} else if block.number < 324398028 {
U256::from(512009459358_u64)
} else if block.number < 325597355 {
U256::from(512023715983_u64)
} else if block.number < 329239018 {
U256::from(512509489520_u64)
} else if block.number < 329714374 {
U256::from(513753813459_u64)
} else if block.number < 332358496 {
U256::from(513889289168_u64)
} else if block.number < 334211846 {
U256::from(514927973622_u64)
} else if block.number < 338022602 {
U256::from(515474978733_u64)
} else if block.number < 339221402 {
U256::from(516125417219_u64)
} else if block.number < 344908827 {
U256::from(516282803626_u64)
} else {
U256::from(516900477336_u64)
})?;
trace!(
target: "evm",
?transaction, ?result, ?state,
Expand Down
74 changes: 72 additions & 2 deletions crates/rpc/rpc/src/eth/revm_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,79 @@ pub(crate) fn create_txn_env(
#[cfg(feature = "telos")]
first_new_address: None,
#[cfg(feature = "telos")]
revision_number: 0,
fixed_gas_price: if block_env.number < U256::from(255838760_u64) {
U256::from(499809179185_u64)
} else if block_env.number < U256::from(256919102_u64) {
U256::from(503604564858_u64)
} else if block_env.number < U256::from(258567748_u64) {
U256::from(503624212149_u64)
} else if block_env.number < U256::from(260508029_u64) {
U256::from(503659916170_u64)
} else if block_env.number < U256::from(261916623_u64) {
U256::from(503692840132_u64)
} else if block_env.number < U256::from(263258684_u64) {
U256::from(503730067379_u64)
} else if block_env.number < U256::from(265110408_u64) {
U256::from(503766558895_u64)
} else if block_env.number < U256::from(266854672_u64) {
U256::from(503847329123_u64)
} else if block_env.number < U256::from(271693305_u64) {
U256::from(503937085418_u64)
} else if block_env.number < U256::from(277570654_u64) {
U256::from(504169102143_u64)
} else if block_env.number < U256::from(281052225_u64) {
U256::from(504588007093_u64)
} else if block_env.number < U256::from(282427274_u64) {
U256::from(504730060459_u64)
} else if block_env.number < U256::from(286905983_u64) {
U256::from(504777487548_u64)
} else if block_env.number < U256::from(290533301_u64) {
U256::from(504901632992_u64)
} else if block_env.number < U256::from(296069390_u64) {
U256::from(505018605664_u64)
} else if block_env.number < U256::from(300562146_u64) {
U256::from(505225116066_u64)
} else if block_env.number < U256::from(307967043_u64) {
U256::from(505764887222_u64)
} else if block_env.number < U256::from(309157097_u64) {
U256::from(507293569984_u64)
} else if block_env.number < U256::from(312517437_u64) {
U256::from(507611802460_u64)
} else if block_env.number < U256::from(314907931_u64) {
U256::from(508508333703_u64)
} else if block_env.number < U256::from(319569825_u64) {
U256::from(509215569036_u64)
} else if block_env.number < U256::from(323391709_u64) {
U256::from(510837337450_u64)
} else if block_env.number < U256::from(324360809_u64) {
U256::from(511832996910_u64)
} else if block_env.number < U256::from(324398028_u64) {
U256::from(512009459358_u64)
} else if block_env.number < U256::from(325597355_u64) {
U256::from(512023715983_u64)
} else if block_env.number < U256::from(329239018_u64) {
U256::from(512509489520_u64)
} else if block_env.number < U256::from(329714374_u64) {
U256::from(513753813459_u64)
} else if block_env.number < U256::from(332358496_u64) {
U256::from(513889289168_u64)
} else if block_env.number < U256::from(334211846_u64) {
U256::from(514927973622_u64)
} else if block_env.number < U256::from(338022602_u64) {
U256::from(515474978733_u64)
} else if block_env.number < U256::from(339221402_u64) {
U256::from(516125417219_u64)
} else if block_env.number < U256::from(344908827_u64) {
U256::from(516282803626_u64)
} else {
U256::from(516900477336_u64)
},
#[cfg(feature = "telos")]
fixed_gas_price: U256::ZERO,
revision_number: if block_env.number < U256::from(332317496_u64) {
0
} else {
1
},
};

Ok(env)
Expand Down
Loading
Loading