From 63b9b5452ffe2504adf69ba12c7098880e2c0bc6 Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Tue, 9 Mar 2021 12:41:51 +0100 Subject: [PATCH] Rename: Channel -> ChannelDefinition To avoid name clash with upcoming channel abstraction in the wallet. --- nitro/protocol/channel.nim | 4 ++-- nitro/protocol/state.nim | 2 +- tests/nitro/protocol/examples.nim | 6 +++--- tests/nitro/protocol/testChannel.nim | 6 +++--- tests/nitro/protocol/testSignature.nim | 2 +- tests/nitro/protocol/testState.nim | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/nitro/protocol/channel.nim b/nitro/protocol/channel.nim index 0d65a70..d454a86 100644 --- a/nitro/protocol/channel.nim +++ b/nitro/protocol/channel.nim @@ -7,12 +7,12 @@ include questionable/errorban export basics type - Channel* = object + ChannelDefinition* = object nonce*: UInt48 participants*: seq[EthAddress] chainId*: UInt256 -proc getChannelId*(channel: Channel): array[32, byte] = +proc getChannelId*(channel: ChannelDefinition): array[32, byte] = var encoder= AbiEncoder.init() encoder.startTuple() encoder.write(channel.chainId) diff --git a/nitro/protocol/state.nim b/nitro/protocol/state.nim index 60da40b..9629ced 100644 --- a/nitro/protocol/state.nim +++ b/nitro/protocol/state.nim @@ -14,7 +14,7 @@ type State* = object turnNum*: UInt48 isFinal*: bool - channel*: Channel + channel*: ChannelDefinition challengeDuration*: UInt48 outcome*: Outcome appDefinition*: EthAddress diff --git a/tests/nitro/protocol/examples.nim b/tests/nitro/protocol/examples.nim index b37cb3c..1337afc 100644 --- a/tests/nitro/protocol/examples.nim +++ b/tests/nitro/protocol/examples.nim @@ -27,8 +27,8 @@ proc example*(_: type UInt128): UInt128 = proc example*(_: type EthAddress): EthAddress = EthAddress(array[20, byte].example) -proc example*(_: type Channel): Channel = - Channel( +proc example*(_: type ChannelDefinition): ChannelDefinition = + ChannelDefinition( nonce: UInt48.example, participants: seq[EthAddress].example(2..5), chainId: UInt256.example @@ -72,7 +72,7 @@ proc example*(_: type State): State = State( turnNum: UInt48.example, isFinal: bool.example, - channel: Channel.example, + channel: ChannelDefinition.example, challengeDuration: UInt48.example, outcome: Outcome.example, appDefinition: EthAddress.example, diff --git a/tests/nitro/protocol/testChannel.nim b/tests/nitro/protocol/testChannel.nim index fb520cf..af58874 100644 --- a/tests/nitro/protocol/testChannel.nim +++ b/tests/nitro/protocol/testChannel.nim @@ -3,9 +3,9 @@ import pkg/nitro/protocol/abi import pkg/nimcrypto import pkg/stew/byteutils -suite "channel": +suite "channel definition": - let channel = Channel.example + let channel = ChannelDefinition.example test "calculates channel id": var encoder= AbiEncoder.init() @@ -19,7 +19,7 @@ suite "channel": check getChannelId(channel) == hashed test "produces same id as javascript implementation": - let channel = Channel( + let channel = ChannelDefinition( chainId: 9001.u256, nonce: 1, participants: @[ diff --git a/tests/nitro/protocol/testSignature.nim b/tests/nitro/protocol/testSignature.nim index 7c9ce34..1eb0495 100644 --- a/tests/nitro/protocol/testSignature.nim +++ b/tests/nitro/protocol/testSignature.nim @@ -19,7 +19,7 @@ suite "signature": test "produces the same signatures as the javascript implementation": let state =State( - channel: Channel( + channel: ChannelDefinition( chainId: 0x1.u256, nonce: 1, participants: @[ diff --git a/tests/nitro/protocol/testState.nim b/tests/nitro/protocol/testState.nim index d401933..f2fc58b 100644 --- a/tests/nitro/protocol/testState.nim +++ b/tests/nitro/protocol/testState.nim @@ -48,7 +48,7 @@ suite "state": test "produces the same hash as the javascript implementation": let state = State( - channel: Channel( + channel: ChannelDefinition( chainId: 0x1.u256, nonce: 1, participants: @[