Skip to content

Commit

Permalink
feat: support gasless transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
blckngm authored and jjyr committed Dec 6, 2022
1 parent f84d20b commit 51ff2c1
Show file tree
Hide file tree
Showing 25 changed files with 238 additions and 108 deletions.
95 changes: 38 additions & 57 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion crates/benches/benches/benchmarks/smt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl BenchExecutionEnvironment {
let rollup_context = RollupContext {
rollup_config: genesis_config.rollup_config.clone().into(),
rollup_script_hash: ROLLUP_TYPE_HASH.into(),
fork_config: Default::default(),
..Default::default()
};

let backend_manage = {
Expand Down
2 changes: 1 addition & 1 deletion crates/benches/benches/benchmarks/sudt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ fn run_contract_get_result<S: State + CodeStore + JournalDB>(
let rollup_ctx = RollupContext {
rollup_config: rollup_config.clone(),
rollup_script_hash: [42u8; 32].into(),
fork_config: Default::default(),
..Default::default()
};
let generator = Generator::new(
backend_manage,
Expand Down
1 change: 1 addition & 0 deletions crates/block-producer/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,7 @@ pub async fn run(config: Config, skip_config_check: bool) -> Result<()> {
dynamic_config_manager,
polyjuice_sender_recover,
debug_backend_forks: config.debug_backend_forks.clone(),
gasless_tx_support_config: config.gasless_tx_support.clone(),
};

let rpc_registry = Registry::create(args).await;
Expand Down
4 changes: 2 additions & 2 deletions crates/block-producer/src/withdrawal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ mod test {
.withdrawal_script_type_hash(H256::from_u32(100).pack())
.finality_blocks(1u64.pack())
.build(),
fork_config: Default::default(),
..Default::default()
};

let sudt_script = Script::new_builder()
Expand Down Expand Up @@ -464,7 +464,7 @@ mod test {
.l1_sudt_script_type_hash(sudt_script.code_hash())
.finality_blocks(1u64.pack())
.build(),
fork_config: Default::default(),
..Default::default()
};

let contracts_dep = {
Expand Down
9 changes: 9 additions & 0 deletions crates/config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ pub struct Config {
pub p2p_network_config: Option<P2PNetworkConfig>,
#[serde(default)]
pub sync_server: SyncServerConfig,
/// Gasless tx support is enabled when this config presents.
#[serde(default)]
pub gasless_tx_support: Option<GaslessTxSupportConfig>,
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Hash)]
Expand Down Expand Up @@ -277,6 +280,12 @@ impl Default for DebugConfig {
}
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)]
pub struct GaslessTxSupportConfig {
/// Gasless tx entrypoint address.
pub entrypoint_address: H160,
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct OffChainValidatorConfig {
pub verify_withdrawal_signature: bool,
Expand Down
4 changes: 2 additions & 2 deletions crates/generator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ lazy_static = "1.4"
rlp = "0.5.0"
secp256k1 = { version = "0.20", features = ["recovery"] }
substrate-bn = { git = "https://github.com/paritytech/bn.git", rev = "63f8c58" }
sha3 = "0.9.1"
sha3 = "0.10.6"
log = "0.4"
hex = "0.4"
tokio = "1"
arc-swap = "1.5"
ethabi = "16.0.0"
ethabi = { version = "18.0.0", default-features = false, features = ["thiserror", "std"] }
tracing = { version = "0.1", features = ["attributes"] }

[dev-dependencies]
Expand Down
Loading

0 comments on commit 51ff2c1

Please sign in to comment.