-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from jsign/jsign-vm2
Implement the block execution pipeline
- Loading branch information
Showing
29 changed files
with
1,342 additions
and
873 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const std = @import("std"); | ||
const types = @import("../types/types.zig"); | ||
const Address = types.Address; | ||
|
||
pub const gas_limit_adjustement_factor = 1024; | ||
pub const gas_limit_minimum = 5000; | ||
pub const gas_init_code_word_const = 2; | ||
|
||
pub const tx_base_cost = 21000; | ||
pub const tx_data_cost_per_zero = 4; | ||
pub const tx_data_cost_per_non_zero = 16; | ||
pub const tx_create_cost = 32000; | ||
pub const tx_access_list_address_cost = 2400; | ||
pub const tx_access_list_storage_key_cost = 1900; | ||
|
||
pub const base_fee_max_change_denominator = 8; | ||
pub const elasticity_multiplier = 2; | ||
pub const max_code_size = 0x6000; | ||
|
||
pub const stack_depth_limit = 1024; | ||
|
||
pub const precompiled_contract_addresses = [_]Address{ | ||
addressFromInt(1), // ECRECOVER | ||
addressFromInt(2), // SHA256 | ||
addressFromInt(3), // RIPEMD160 | ||
addressFromInt(4), // IDENTITY_ADDRESS | ||
addressFromInt(5), // MODEXP_ADDRESS | ||
addressFromInt(6), // ALT_BN128_ADD | ||
addressFromInt(7), // ALT_BN128_MUL | ||
addressFromInt(8), // ALT_BN128_PAIRING_CHECK | ||
addressFromInt(9), // BLAKE2F | ||
}; | ||
|
||
fn addressFromInt(comptime i: u160) Address { | ||
var addr: Address = undefined; | ||
std.mem.writeInt(u160, &addr, i, .Big); | ||
return addr; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const types = @import("../types/types.zig"); | ||
const config = @import("../config/config.zig"); | ||
const common = @import("../common/common.zig"); | ||
const StateDB = @import("../state/state.zig").StateDB; | ||
const Address = types.Address; | ||
const Hash32 = types.Hash32; | ||
const Bytes32 = types.Bytes32; | ||
const AddressSet = common.AddressSet; | ||
const AddresssKey = common.AddressKey; | ||
const AddressKeySet = common.AddressKeySet; | ||
|
||
pub const Environment = struct { | ||
block_hashes: [256]Hash32, | ||
origin: Address, | ||
coinbase: Address, | ||
number: u64, | ||
base_fee_per_gas: u256, | ||
gas_limit: u64, | ||
gas_price: u256, | ||
time: u64, | ||
prev_randao: Bytes32, | ||
state: *StateDB, | ||
chain_id: config.ChainId, | ||
}; | ||
|
||
pub const Message = struct { | ||
caller: Address, | ||
target: ?Address, | ||
current_target: Address, | ||
gas: u64, | ||
value: u256, | ||
data: []const u8, | ||
code_address: ?Address, | ||
code: []const u8, | ||
}; |
Oops, something went wrong.