mirror of
https://github.com/logos-storage/nim-nitro.git
synced 2026-01-02 13:43:06 +00:00
Rename: Channel -> ChannelDefinition
To avoid name clash with upcoming channel abstraction in the wallet.
This commit is contained in:
parent
f7dda63c04
commit
63b9b5452f
@ -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)
|
||||
|
||||
@ -14,7 +14,7 @@ type
|
||||
State* = object
|
||||
turnNum*: UInt48
|
||||
isFinal*: bool
|
||||
channel*: Channel
|
||||
channel*: ChannelDefinition
|
||||
challengeDuration*: UInt48
|
||||
outcome*: Outcome
|
||||
appDefinition*: EthAddress
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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: @[
|
||||
|
||||
@ -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: @[
|
||||
|
||||
@ -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: @[
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user