Skip to content

Commit

Permalink
Add block_base_fee to evmc_tx_context (EIP-3198)
Browse files Browse the repository at this point in the history
  • Loading branch information
yperbasis authored and chfast committed May 28, 2021
1 parent da67705 commit 341e029
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions bindings/go/evmc/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ type TxContext struct {
GasLimit int64
Difficulty Hash
ChainID Hash
BaseFee Hash // EIP-1559, EIP-3198
}

type HostContext interface {
Expand Down Expand Up @@ -174,6 +175,7 @@ func getTxContext(pCtx unsafe.Pointer) C.struct_evmc_tx_context {
C.int64_t(txContext.GasLimit),
evmcBytes32(txContext.Difficulty),
evmcBytes32(txContext.ChainID),
evmcBytes32(txContext.BaseFee),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public ByteBuffer call(ByteBuffer msg) {

@Override
public ByteBuffer getTxContext() {
return ByteBuffer.allocateDirect(160).put(new byte[160]);
return ByteBuffer.allocateDirect(192).put(new byte[192]);
}

@Override
Expand Down
1 change: 1 addition & 0 deletions bindings/rust/evmc-vm/src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ mod tests {
block_gas_limit: 0,
block_difficulty: Uint256::default(),
chain_id: Uint256::default(),
block_base_fee: Uint256::default(),
}
}

Expand Down
1 change: 1 addition & 0 deletions bindings/rust/evmc-vm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,7 @@ mod tests {
block_gas_limit: 105023,
block_difficulty: Uint256 { bytes: [0xaa; 32] },
chain_id: Uint256::default(),
block_base_fee: Uint256::default(),
}
}

Expand Down
1 change: 1 addition & 0 deletions include/evmc/evmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ struct evmc_tx_context
int64_t block_gas_limit; /**< The block gas limit. */
evmc_uint256be block_difficulty; /**< The block difficulty. */
evmc_uint256be chain_id; /**< The blockchain's ChainID. */
evmc_uint256be block_base_fee; /**< The block base fee per gas (EIP-1559, EIP-3198). */
};

/**
Expand Down

0 comments on commit 341e029

Please sign in to comment.