diff --git a/.gitignore b/.gitignore index f4029e16acf02..87e6d3aee2d35 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,6 @@ _ .vite .wrangler *.zip + +# internal notes +.notes \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index fb1b4b99e5f5a..2194393c3a18b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -143,9 +143,9 @@ dependencies = [ [[package]] name = "alloy-dyn-abi" -version = "1.5.3" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "787cb8baf0e681d995c4a4d49713d56b91083930ae42d5d277a07276cafbe76f" +checksum = "14ff5ee5f27aa305bda825c735f686ad71bb65508158f059f513895abe69b8c3" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -312,9 +312,9 @@ dependencies = [ [[package]] name = "alloy-json-abi" -version = "1.5.3" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dad32d0724b70717ce15a76b48f11a4438010b85a90f728f476e99d5a6b06379" +checksum = "8708475665cc00e081c085886e68eada2f64cfa08fc668213a9231655093d4de" dependencies = [ "alloy-primitives", "alloy-sol-type-parser", @@ -418,9 +418,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "1.5.3" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1841ce147fa6cfdeb6b7751e2583b605bb8eef4238a2d3e0880b5cb3aba0e83" +checksum = "3b88cf92ed20685979ed1d8472422f0c6c2d010cec77caf63aaa7669cc1a7bc2" dependencies = [ "alloy-rlp", "arbitrary", @@ -835,9 +835,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "1.5.3" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25d4b140adc0e4f7bd2b4928d2772fbdf4db114312c4619eff08eba7b6440b9e" +checksum = "f5fa1ca7e617c634d2bd9fa71f9ec8e47c07106e248b9fcbd3eaddc13cabd625" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", @@ -849,9 +849,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-expander" -version = "1.5.3" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0512730c0658dab978c9706b592c378974fe49cd14614083a37f7f396aaf2eb5" +checksum = "27c00c0c3a75150a9dc7c8c679ca21853a137888b4e1c5569f92d7e2b15b5102" dependencies = [ "alloy-json-abi", "alloy-sol-macro-input", @@ -861,16 +861,16 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", + "sha3", "syn 2.0.114", "syn-solidity", - "tiny-keccak", ] [[package]] name = "alloy-sol-macro-input" -version = "1.5.3" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7f5b5f9e6fc8af3420d527cab5eecddc9c437227df251b3c7eb70b0941d8bd5" +checksum = "297db260eb4d67c105f68d6ba11b8874eec681caec5505eab8fbebee97f790bc" dependencies = [ "alloy-json-abi", "const-hex", @@ -886,9 +886,9 @@ dependencies = [ [[package]] name = "alloy-sol-type-parser" -version = "1.5.3" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6dbdf239d997b705e1c23cc8bb43f301db615b187379fa923d87723d47fcd31" +checksum = "94b91b13181d3bcd23680fd29d7bc861d1f33fbe90fdd0af67162434aeba902d" dependencies = [ "serde", "winnow", @@ -896,9 +896,9 @@ dependencies = [ [[package]] name = "alloy-sol-types" -version = "1.5.3" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a8a2c35dbb545c6945b933957556693839df252c712194bf201c9e528670a3" +checksum = "fc442cc2a75207b708d481314098a0f8b6f7b58e3148dd8d8cc7407b0d6f9385" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -1894,9 +1894,9 @@ dependencies = [ [[package]] name = "aws-smithy-async" -version = "1.2.8" +version = "1.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9330762ee48c6cecfad2cb37b1506c16c8e858c90638eda2b1a7272b56f88bd5" +checksum = "4e0e99800414b0c4cae85ed775a1559f8992f4e69f5ebafe9c936e29609eae78" dependencies = [ "futures-util", "pin-project-lite", @@ -1926,9 +1926,9 @@ dependencies = [ [[package]] name = "aws-smithy-http-client" -version = "1.1.6" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec918f18147cec121cb142a91b0038f66d99bbe903e585dccf871920e90b22ab" +checksum = "23141f8daeab46574a1969ddb7316bc2928732e5721b3abfa8d1e16927ea9a52" dependencies = [ "aws-smithy-async", "aws-smithy-runtime-api", @@ -1959,18 +1959,18 @@ dependencies = [ [[package]] name = "aws-smithy-observability" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a700a7702874cd78b85fecdc9f64f3f72eb22fb713791cb445bcfd2a15bc1ecf" +checksum = "112e30b3c5379273de88c8cedfc96ce0211e9af22115ceb6975b5c072eccdfb9" dependencies = [ "aws-smithy-runtime-api", ] [[package]] name = "aws-smithy-query" -version = "0.60.10" +version = "0.60.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc4a6cdc289a37be7fddb7f4365448187d62c603a40e6d46d13c68e5e81900f" +checksum = "2a57c5122eafc566cba4d3cbaacb53dd8a0cacd71155c728d1f4a9179cdd75ae" dependencies = [ "aws-smithy-types", "urlencoding", @@ -2002,9 +2002,9 @@ dependencies = [ [[package]] name = "aws-smithy-runtime-api" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c47b1e62accf759b01aba295e40479d1ba8fb77c2a54f0fed861c809ca49761" +checksum = "1d09ba34c17c65a53b65b0ec0d80cf7a934947d407cb7c4fb7753f96de147663" dependencies = [ "aws-smithy-async", "aws-smithy-types", @@ -2019,9 +2019,9 @@ dependencies = [ [[package]] name = "aws-smithy-types" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2d447863bdec38c899e5753a48c0abcf590f3ec629e257ad5a9ef8806ad7714" +checksum = "8169129deda9dc18731b7b160f75121507e02f45f2101e48f0252dcd997e9da1" dependencies = [ "base64-simd", "bytes", @@ -2667,9 +2667,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.54" +version = "1.2.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6354c81bbfd62d9cfa9cb3c773c2b7b2a3a482d569de977fd0e961f6e7c00583" +checksum = "47b26a0954ae34af09b50f0de26458fa95369a0d478d8236d3f93082b219bd29" dependencies = [ "find-msvc-tools", "jobserver", @@ -2784,9 +2784,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.55" +version = "4.5.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e34525d5bbbd55da2bb745d34b36121baac88d07619a9a09cfcf4a6c0832785" +checksum = "a75ca66430e33a14957acc24c5077b503e7d374151b2b4b3a10c83b4ceb4be0e" dependencies = [ "clap_builder", "clap_derive", @@ -2804,9 +2804,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.55" +version = "4.5.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59a20016a20a3da95bef50ec7238dbd09baeef4311dcdd38ec15aba69812fb61" +checksum = "793207c7fa6300a0608d1080b858e5fdbe713cdc1c8db9fb17777d8a13e63df0" dependencies = [ "anstream", "anstyle", @@ -2864,7 +2864,7 @@ dependencies = [ "terminfo", "thiserror 2.0.18", "which", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -3012,7 +3012,7 @@ version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "faf9468729b8cbcea668e36183cb69d317348c2e08e994829fb56ebfdfbaac34" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -3661,7 +3661,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -3966,7 +3966,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -4177,9 +4177,9 @@ dependencies = [ [[package]] name = "find-msvc-tools" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8591b0bcc8a98a64310a2fae1bb3e9b8564dd10e381e6e28010fde8e8e8568db" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" [[package]] name = "fixed-hash" @@ -5039,6 +5039,7 @@ dependencies = [ "futures", "itertools 0.14.0", "memchr", + "monad-revm", "rayon", "reqwest", "revm", @@ -5776,7 +5777,7 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite", - "socket2 0.6.2", + "socket2 0.5.10", "system-configuration", "tokio", "tower-service", @@ -6153,7 +6154,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" dependencies = [ "hermit-abi", "libc", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -6744,7 +6745,7 @@ dependencies = [ [[package]] name = "monad-revm" version = "0.1.0" -source = "git+https://github.com/category-labs/monad-revm?branch=main#f5149bc85e9a225a5c04c7bcdef5df9fd3251983" +source = "git+https://github.com/category-labs/monad-revm?branch=main#c96e2101a6e97bb4329cdd6d969b150f3bdb6464" dependencies = [ "alloy-evm", "alloy-sol-types", @@ -6872,7 +6873,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -7886,7 +7887,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" dependencies = [ "anyhow", - "itertools 0.14.0", + "itertools 0.12.1", "proc-macro2", "quote", "syn 2.0.114", @@ -7899,7 +7900,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27c6023962132f4b30eb4c172c91ce92d933da334c59c23cddee82358ddafb0b" dependencies = [ "anyhow", - "itertools 0.14.0", + "itertools 0.12.1", "proc-macro2", "quote", "syn 2.0.114", @@ -8022,7 +8023,7 @@ dependencies = [ "quinn-udp", "rustc-hash", "rustls", - "socket2 0.6.2", + "socket2 0.5.10", "thiserror 2.0.18", "tokio", "tracing", @@ -8059,9 +8060,9 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2 0.6.2", + "socket2 0.5.10", "tracing", - "windows-sys 0.60.2", + "windows-sys 0.59.0", ] [[package]] @@ -8778,7 +8779,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.11.0", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -9562,7 +9563,7 @@ dependencies = [ "derive_more", "dunce", "inturn", - "itertools 0.14.0", + "itertools 0.12.1", "itoa", "normalize-path", "once_map", @@ -9574,7 +9575,7 @@ dependencies = [ "solar-config", "solar-data-structures", "solar-macros", - "thiserror 2.0.18", + "thiserror 1.0.69", "tracing", "unicode-width 0.2.0", ] @@ -9597,7 +9598,7 @@ dependencies = [ "alloy-primitives", "bitflags 2.10.0", "bumpalo", - "itertools 0.14.0", + "itertools 0.12.1", "memchr", "num-bigint", "num-rational", @@ -9906,7 +9907,7 @@ dependencies = [ "serde_json", "sha2", "tempfile", - "thiserror 2.0.18", + "thiserror 1.0.69", "url", "zip", ] @@ -9947,9 +9948,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "1.5.3" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e629391be459480417646f7ca78894442249262a6e095dbd6e4ab6988cfafce0" +checksum = "2379beea9476b89d0237078be761cf8e012d92d5ae4ae0c9a329f974838870fc" dependencies = [ "paste", "proc-macro2", @@ -10020,7 +10021,7 @@ dependencies = [ "getrandom 0.3.4", "once_cell", "rustix 1.1.3", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -10040,7 +10041,7 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8c27177b12a6399ffc08b98f76f7c9a1f4fe9fc967c784c5a071fa8d93cf7e1" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -10200,15 +10201,6 @@ dependencies = [ "time-core", ] -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - [[package]] name = "tinystr" version = "0.8.2" @@ -11341,7 +11333,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -11815,18 +11807,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.35" +version = "0.8.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdea86ddd5568519879b8187e1cf04e24fce28f7fe046ceecbce472ff19a2572" +checksum = "dafd85c832c1b68bbb4ec0c72c7f6f4fc5179627d2bc7c26b30e4c0cc11e76cc" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.35" +version = "0.8.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c15e1b46eff7c6c91195752e0eeed8ef040e391cdece7c25376957d5f15df22" +checksum = "7cb7e4e8436d9db52fbd6625dbf2f45243ab84994a72882ec8227b99e72b439a" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 8682616de4c61..4f14b057438d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -297,7 +297,7 @@ alloy-monad-evm = { git = "https://github.com/haythemsellami/evm", branch = "mai revm = { version = "34.0.0", default-features = false } revm-inspectors = { version = "0.33.2", features = ["serde"] } op-revm = { version = "15.0.0", default-features = false } -monad-revm = { git = "https://github.com/category-labs/monad-revm", branch = "main" } +monad-revm = { git = "https://github.com/category-labs/monad-revm", branch = "main", features = ["alloy-evm"] } ## cli anstream = "0.6" @@ -463,3 +463,4 @@ solar = { package = "solar-compiler", git = "https://github.com/paradigmxyz/sola solar-interface = { package = "solar-interface", git = "https://github.com/paradigmxyz/solar.git", rev = "1f28069" } solar-ast = { package = "solar-ast", git = "https://github.com/paradigmxyz/solar.git", rev = "1f28069" } solar-sema = { package = "solar-sema", git = "https://github.com/paradigmxyz/solar.git", rev = "1f28069" } + diff --git a/README.md b/README.md index 7216048b8760e..d53df72deb903 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Monad Foundry is under active development! Expect a lot of new features to appea - [x] Blob transaction rejection (EIP-4844 not supported) - [ ] Reserve balance for delegated EOAs - [ ] EIP-7702 restrictions (CREATE/CREATE2 banned for delegated EOAs) -- [ ] Monad staking precompiles +- [x] Monad precompiles: [see below section for more details](#monad-precompiles) ### Forge @@ -35,7 +35,7 @@ Forge commands (`forge test`, `forge script`, `forge debug`) always execute usin - [x] `forge test` aexecutes with Monad EVM - [x] `forge script` executes with Monad EVM -- [ ] Monad staking precompiles +- [x] Monad precompiles: [see below section for more details](#monad-precompiles) ### Cast @@ -45,6 +45,14 @@ Forge commands (`forge test`, `forge script`, `forge debug`) always execute usin - [x] Executes with Monad EVM specs & config +## Monad Precompiles + +### Staking + +The following view functions are supported: `getEpoch`, `getProposerValId`, `getValidator`, `getDelegator`, `getWithdrawalRequest`, `getConsensusValidatorSet`, `getSnapshotValidatorSet`, `getExecutionValidatorSet`. + +Note: `getDelegator` reads raw storage without calling `pull_delegator_up_to_date()`, the returned value will be correct on a new initiated fork state, but on a local anvil pending delegations may not be reflected. + ## Installation Getting started is very easy: diff --git a/crates/evm/core/src/evm.rs b/crates/evm/core/src/evm.rs index b2b6e6bdb1325..4b50ad4135852 100644 --- a/crates/evm/core/src/evm.rs +++ b/crates/evm/core/src/evm.rs @@ -12,7 +12,8 @@ use alloy_primitives::{Address, Bytes, U256}; use foundry_fork_db::DatabaseError; use monad_revm::{ MonadCfgEnv, MonadContext, MonadEvm as InnerMonadEvm, MonadSpecId, - instructions::MonadInstructions, precompiles::MonadPrecompiles, + instructions::MonadInstructions, + precompiles::{MonadPrecompiles, extend_monad_precompiles}, }; use revm::{ Context, Journal, @@ -85,7 +86,11 @@ pub fn new_evm_with_existing_context<'a>( /// Get the Monad precompiles for the given spec. fn get_precompiles(spec: MonadSpecId) -> PrecompilesMap { - PrecompilesMap::from_static(MonadPrecompiles::new_with_spec(spec).precompiles()) + let mut precompiles = + PrecompilesMap::from_static(MonadPrecompiles::new_with_spec(spec).precompiles()); + // Add staking precompile via dynamic lookup + extend_monad_precompiles(&mut precompiles); + precompiles } /// Get the call inputs for the CREATE2 factory. diff --git a/crates/evm/traces/Cargo.toml b/crates/evm/traces/Cargo.toml index 4eed2fcf4f10b..69de201955271 100644 --- a/crates/evm/traces/Cargo.toml +++ b/crates/evm/traces/Cargo.toml @@ -31,6 +31,7 @@ alloy-primitives = { workspace = true, features = [ ] } alloy-sol-types.workspace = true revm-inspectors.workspace = true +monad-revm.workspace = true async-trait.workspace = true eyre.workspace = true diff --git a/crates/evm/traces/src/decoder/mod.rs b/crates/evm/traces/src/decoder/mod.rs index 4f377fe03c510..b1d3c6bce2d0e 100644 --- a/crates/evm/traces/src/decoder/mod.rs +++ b/crates/evm/traces/src/decoder/mod.rs @@ -23,11 +23,71 @@ use foundry_evm_core::{ }, }; use itertools::Itertools; +use monad_revm::staking::STAKING_ADDRESS; use revm_inspectors::tracing::types::{DecodedCallLog, DecodedCallTrace}; use std::{collections::BTreeMap, sync::OnceLock}; mod precompiles; +alloy_sol_types::sol! { + /// Monad staking precompile interface at address 0x1000. + /// Reference: https://docs.monad.xyz/developer-essentials/staking/staking-precompile + #[sol(abi)] + interface IMonadStaking { + // View functions + function getEpoch() external returns (uint64 epoch, bool inEpochDelayPeriod); + function getProposerValId() external returns (uint64 val_id); + function getValidator(uint64 validatorId) external view returns ( + address authAddress, uint64 flags, uint256 stake, + uint256 accRewardPerToken, uint256 commission, uint256 unclaimedRewards, + uint256 consensusStake, uint256 consensusCommission, + uint256 snapshotStake, uint256 snapshotCommission, + bytes memory secpPubkey, bytes memory blsPubkey); + function getDelegator(uint64 validatorId, address delegator) external returns ( + uint256 stake, uint256 accRewardPerToken, uint256 unclaimedRewards, + uint256 deltaStake, uint256 nextDeltaStake, uint64 deltaEpoch, uint64 nextDeltaEpoch); + function getWithdrawalRequest(uint64 validatorId, address delegator, uint8 withdrawId) + external returns (uint256 withdrawalAmount, uint256 accRewardPerToken, uint64 withdrawEpoch); + function getConsensusValidatorSet(uint32 startIndex) + external returns (bool isDone, uint32 nextIndex, uint64[] memory valIds); + function getSnapshotValidatorSet(uint32 startIndex) + external returns (bool isDone, uint32 nextIndex, uint64[] memory valIds); + function getExecutionValidatorSet(uint32 startIndex) + external returns (bool isDone, uint32 nextIndex, uint64[] memory valIds); + function getDelegations(address delegator, uint64 startValId) + external returns (bool isDone, uint64 nextValId, uint64[] memory valIds); + function getDelegators(uint64 validatorId, address startDelegator) + external returns (bool isDone, address nextDelegator, address[] memory delegators); + + // State-changing functions + function addValidator(bytes calldata payload, bytes calldata signedSecpMessage, bytes calldata signedBlsMessage) + external payable returns (uint64 validatorId); + function delegate(uint64 validatorId) external payable returns (bool success); + function undelegate(uint64 validatorId, uint256 amount, uint8 withdrawId) external returns (bool success); + function withdraw(uint64 validatorId, uint8 withdrawId) external returns (bool success); + function compound(uint64 validatorId) external returns (bool success); + function claimRewards(uint64 validatorId) external returns (bool success); + function changeCommission(uint64 validatorId, uint256 commission) external returns (bool success); + function externalReward(uint64 validatorId) external returns (bool success); + + // Syscalls + function syscallOnEpochChange(uint64 epoch) external; + function syscallReward(address blockAuthor) external; + function syscallSnapshot() external; + + // Events + event ClaimRewards(uint64 indexed validatorId, address indexed delegator, uint256 amount, uint64 epoch); + event CommissionChanged(uint64 indexed validatorId, uint256 oldCommission, uint256 newCommission); + event Delegate(uint64 indexed validatorId, address indexed delegator, uint256 amount, uint64 activationEpoch); + event EpochChanged(uint64 oldEpoch, uint64 newEpoch); + event Undelegate(uint64 indexed validatorId, address indexed delegator, uint8 withdrawId, uint256 amount, uint64 activationEpoch); + event ValidatorCreated(uint64 indexed validatorId, address indexed authAddress, uint256 commission); + event ValidatorRewarded(uint64 indexed validatorId, address indexed from, uint256 amount, uint64 epoch); + event ValidatorStatusChanged(uint64 indexed validatorId, uint64 flags); + event Withdraw(uint64 indexed validatorId, address indexed delegator, uint8 withdrawId, uint256 amount, uint64 withdrawEpoch); + } +} + /// Build a new [CallTraceDecoder]. #[derive(Default)] #[must_use = "builders do nothing unless you call `build` on them"] @@ -183,6 +243,8 @@ impl CallTraceDecoder { (EC_PAIRING, "ECPairing".to_string()), (BLAKE_2F, "Blake2F".to_string()), (POINT_EVALUATION, "PointEvaluation".to_string()), + // Monad staking precompile + (STAKING_ADDRESS, "Staking".to_string()), ]), receive_contracts: Default::default(), fallback_contracts: Default::default(), @@ -191,11 +253,13 @@ impl CallTraceDecoder { functions: console::hh::abi::functions() .into_values() .chain(Vm::abi::functions().into_values()) + .chain(IMonadStaking::abi::functions().into_values()) .flatten() .map(|func| (func.selector(), vec![func])) .collect(), events: console::ds::abi::events() .into_values() + .chain(IMonadStaking::abi::events().into_values()) .flatten() .map(|event| ((event.selector(), indexed_inputs(&event)), vec![event])) .collect(),