From b5e8a8d61b17c16f32c46a711403741a975fc737 Mon Sep 17 00:00:00 2001 From: andri lim Date: Tue, 12 Nov 2019 19:41:19 +0700 Subject: [PATCH] implement 'chainId' opcode --- nimbus/vm/interpreter/opcode_values.nim | 2 +- nimbus/vm/interpreter/opcodes_impl.nim | 4 ++-- nimbus/vm/interpreter_dispatch.nim | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nimbus/vm/interpreter/opcode_values.nim b/nimbus/vm/interpreter/opcode_values.nim index 0de3b2bc4..f85a354ca 100644 --- a/nimbus/vm/interpreter/opcode_values.nim +++ b/nimbus/vm/interpreter/opcode_values.nim @@ -79,7 +79,7 @@ fill_enum_holes: Difficulty = 0x44, # Get the block's difficulty. GasLimit = 0x45, # Get the block's gas limit. - ChainID = 0x46, # Get current chain’s EIP-155 unique identifier. + ChainId = 0x46, # Get current chain’s EIP-155 unique identifier. SelfBalance = 0x47, # Get current contract's balance. # 50s: Stack, Memory, Storage and Flow Operations diff --git a/nimbus/vm/interpreter/opcodes_impl.nim b/nimbus/vm/interpreter/opcodes_impl.nim index cbd05a95c..257551270 100644 --- a/nimbus/vm/interpreter/opcodes_impl.nim +++ b/nimbus/vm/interpreter/opcodes_impl.nim @@ -372,10 +372,10 @@ op gasLimit, inline = true: ## 0x45, Get the block's gas limit push: computation.vmState.gasLimit -op chainID, inline = true: +op chainId, inline = true: ## 0x46, Get current chain’s EIP-155 unique identifier. # TODO: this is a stub - push: 0 + push: computation.vmState.chaindb.config.chainId op selfBalance, inline = true: ## 0x47, Get current contract's balance. diff --git a/nimbus/vm/interpreter_dispatch.nim b/nimbus/vm/interpreter_dispatch.nim index c3832b5e0..b59278349 100644 --- a/nimbus/vm/interpreter_dispatch.nim +++ b/nimbus/vm/interpreter_dispatch.nim @@ -217,7 +217,7 @@ let ConstantinopleOpDispatch {.compileTime.}: array[Op, NimNode] = genConstantin proc genIstanbulJumpTable(ops: array[Op, NimNode]): array[Op, NimNode] {.compileTime.} = result = ops - result[ChainID] = newIdentNode "chainID" + result[ChainId] = newIdentNode "chainId" result[SelfBalance] = newIdentNode "selfBalance" let IstanbulOpDispatch {.compileTime.}: array[Op, NimNode] = genIstanbulJumpTable(ConstantinopleOpDispatch)