Skip to content

Commit

Permalink
Merge pull request #26 from statechannels/assetHolderAddress-asset
Browse files Browse the repository at this point in the history
replace assetHolderAddress with asset
  • Loading branch information
geoknee authored Jul 28, 2021
2 parents f194526 + e18790c commit 92c0e82
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 29 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"packages": [
"packages/*"
],
"version": "0.1.6"
"version": "0.1.6-asset"
}
2 changes: 1 addition & 1 deletion packages/native-utils/bench/hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const DEFAULT_STATE = {
challengeDuration: 1,
outcome: [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
allocationItems: [
{
destination:
Expand Down
2 changes: 1 addition & 1 deletion packages/native-utils/bench/recover.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const PRIVATE_KEY = '0x111111111111111111111111111111111111111111111111111111111

const OUTCOME = [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
allocationItems: [
{
destination: '0x0000000000000000000000000000000000000000000000000000000000000000',
Expand Down
2 changes: 1 addition & 1 deletion packages/native-utils/bench/sign.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const PRIVATE_KEY = '0x111111111111111111111111111111111111111111111111111111111

const OUTCOME = [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
allocationItems: [
{
destination: '0x0000000000000000000000000000000000000000000000000000000000000000',
Expand Down
12 changes: 6 additions & 6 deletions packages/native-utils/common/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl Tokenize for AssetOutcomeType {
#[derive(Deserialize,PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct AllocationAssetOutcome {
pub asset_holder_address: Address,
pub asset: Address,
pub allocation_items: Vec<AllocationItem>,
}

Expand Down Expand Up @@ -74,7 +74,7 @@ impl Tokenize for Guarantee {
#[derive(Deserialize,PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct GuaranteeAssetOutcome {
pub asset_holder_address: Address,
pub asset: Address,
pub guarantee: Guarantee,
}

Expand All @@ -96,12 +96,12 @@ pub enum AssetOutcome {

impl Tokenize for AssetOutcome {
fn tokenize(&self) -> Token {
let (asset_holder_address, encoded) = match self {
Self::AllocationAssetOutcome(o) => (o.asset_holder_address, o.encode()),
Self::GuaranteeAssetOutcome(o) => (o.asset_holder_address, o.encode()),
let (asset, encoded) = match self {
Self::AllocationAssetOutcome(o) => (o.asset, o.encode()),
Self::GuaranteeAssetOutcome(o) => (o.asset, o.encode()),
};
Token::Tuple(vec![
asset_holder_address.tokenize(),
asset.tokenize(),
Bytes(encoded).tokenize(),
])
}
Expand Down
6 changes: 3 additions & 3 deletions packages/native-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"name": "@statechannels/native-utils",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"version": "0.1.6",
"version": "0.1.6-asset",
"author": "Jannis Pohlmann <[email protected]>",
"license": "MIT",
"dependencies": {
"@statechannels/wasm-utils": "^0.1.6",
"@statechannels/wasm-utils": "^0.1.6-asset",
"lodash": "^4.17.20"
},
"scripts": {
Expand All @@ -15,7 +15,7 @@
"bench": "node bench/index.js"
},
"devDependencies": {
"@statechannels/nitro-protocol": "^0.11.0",
"@statechannels/nitro-protocol": "0.17.1",
"@types/jest": "^26.0.14",
"benny": "^3.6.14",
"ethers": "5.0.12",
Expand Down
10 changes: 5 additions & 5 deletions packages/native-utils/tests/hash.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ describe('encodeOutcome', () => {
...DEFAULT_STATE,
outcome: [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
allocationItems: [
{
destination:
Expand All @@ -149,7 +149,7 @@ describe('encodeOutcome', () => {
...DEFAULT_STATE,
outcome: [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
allocationItems: [
{
destination:
Expand All @@ -174,7 +174,7 @@ describe('encodeOutcome', () => {
...DEFAULT_STATE,
outcome: [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
guarantee: {
targetChannelId:
'0x0000000000000000000000000000000000000000000000000000000000000000',
Expand Down Expand Up @@ -203,7 +203,7 @@ describe('hashOutcome', () => {
...DEFAULT_STATE,
outcome: [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
allocationItems: [
{
destination:
Expand All @@ -223,7 +223,7 @@ describe('hashOutcome', () => {
...DEFAULT_STATE,
outcome: [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
allocationItems: [
{
destination:
Expand Down
2 changes: 1 addition & 1 deletion packages/native-utils/tests/recover.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const DEFAULT_STATE: State = {
challengeDuration: 1,
outcome: [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
allocationItems: [
{
destination:
Expand Down
4 changes: 2 additions & 2 deletions packages/native-utils/tests/sign.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('Sign state', () => {
test('State with asset allocation outcome', async () => {
const outcome = [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
allocationItems: [
{
destination:
Expand Down Expand Up @@ -71,7 +71,7 @@ describe('Sign state', () => {
test('State with guarantee outcome', async () => {
const outcome = [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
guarantee: {
targetChannelId:
'0x0000000000000000000000000000000000000000000000000000000000000000',
Expand Down
4 changes: 2 additions & 2 deletions packages/native-utils/tests/transition.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as native from '..'

const OUTCOME = [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
guarantee: {
targetChannelId:
'0x0000000000000000000000000000000000000000000000000000000000000000',
Expand Down Expand Up @@ -137,7 +137,7 @@ describe('Validate state transitions', () => {
test('Outcome mismatch mismatch fails', async () => {
const otheroutcome = [
{
assetHolderAddress: '0x0000000000000000000000000000000000000000',
asset: '0x0000000000000000000000000000000000000000',
guarantee: {
targetChannelId:
'0x0000000000000000000000000000000000000000000000000000000000000000',
Expand Down
2 changes: 1 addition & 1 deletion wasm-utils/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion wasm-utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wasm-utils"
version = "0.1.6"
version = "0.1.6-asset"
edition = "2018"
license = "MIT"
authors = [
Expand Down
26 changes: 22 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1735,13 +1735,16 @@
dependencies:
"@sinonjs/commons" "^1.7.0"

"@statechannels/nitro-protocol@^0.11.0":
version "0.11.0"
resolved "https://registry.yarnpkg.com/@statechannels/nitro-protocol/-/nitro-protocol-0.11.0.tgz#deb3e09198dd4f4428723738465fc67732486c4f"
integrity sha512-qLYLpJ3dS3PL/daXKSwK7XJVCSHkbPLOtLiLk9yT0EWMJEJy9PlCXQzWwh6ES4uz1M9Ph0hDhpOx+Rw9vf8N1Q==
"@statechannels/nitro-protocol@0.17.1":
version "0.17.1"
resolved "https://registry.yarnpkg.com/@statechannels/nitro-protocol/-/nitro-protocol-0.17.1.tgz#8e6bd0cd826ed8b5216009e1f30fcbeeb1c9099d"
integrity sha512-Axyprx+iG5Dj6ujiWXjkHlAzhEiQ3Fpwjmdgw9Q2PGexCFcU6vfwtztqTdlkqYnjLDsw5kK/au/rJ6r7wfNpbA==
dependencies:
"@openzeppelin/contracts" "3.2.2-solc-0.7"
ethers "5.0.12"
lodash.isequal "^4.5.0"
lodash.pick "4.4.0"
lodash.shuffle "^4.2.0"

"@types/babel__core@^7.0.0", "@types/babel__core@^7.1.7":
version "7.1.9"
Expand Down Expand Up @@ -5183,6 +5186,11 @@ lodash.get@^4.4.2:
resolved "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"
integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=

lodash.isequal@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0"
integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA=

lodash.ismatch@^4.4.0:
version "4.4.0"
resolved "https://registry.npmjs.org/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37"
Expand All @@ -5198,11 +5206,21 @@ lodash.padend@^4.6.1:
resolved "https://registry.npmjs.org/lodash.padend/-/lodash.padend-4.6.1.tgz#53ccba047d06e158d311f45da625f4e49e6f166e"
integrity sha1-U8y6BH0G4VjTEfRdpiX05J5vFm4=

[email protected]:
version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.pick/-/lodash.pick-4.4.0.tgz#52f05610fff9ded422611441ed1fc123a03001b3"
integrity sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM=

lodash.set@^4.3.2:
version "4.3.2"
resolved "https://registry.npmjs.org/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23"
integrity sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM=

lodash.shuffle@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/lodash.shuffle/-/lodash.shuffle-4.2.0.tgz#145b5053cf875f6f5c2a33f48b6e9948c6ec7b4b"
integrity sha1-FFtQU8+HX29cKjP0i26ZSMbse0s=

lodash.sortby@^4.7.0:
version "4.7.0"
resolved "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
Expand Down

0 comments on commit 92c0e82

Please sign in to comment.