Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possibility to incentivise relayer on consumer chain #38

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.8.0]

### Added

- randomness simulator (a predictable random seed based on block hash)
- The callback now contains a field with the relayer address. This would allow Dapps to incentivise the relayer
2 changes: 1 addition & 1 deletion 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "nois"
description = "The Nois standard library"
repository = "https://github.com/noislabs/nois"
version = "0.7.0"
version = "0.8.0"
edition = "2021"
license = "Apache-2.0"
readme = "README.md"
Expand Down
8 changes: 6 additions & 2 deletions src/proxy.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cosmwasm_schema::cw_serde;
use cosmwasm_std::{HexBinary, Timestamp};
use cosmwasm_std::{Addr, HexBinary, Timestamp};

/// Max length that the job ID is allowed to have (in bytes)
///
Expand Down Expand Up @@ -47,6 +47,9 @@ pub struct NoisCallback {
pub published: Timestamp,
/// The randomness. This is guaranteed to be 32 bytes long.
pub randomness: HexBinary,
/// The relayer that brings the packet from Nois to the consumer chain.
/// Might be useful if the Dapp wants to incentivise the relayer operator
pub relayer: Addr,
}

/// This is just a helper to properly serialize the above callback.
Expand Down Expand Up @@ -74,12 +77,13 @@ mod tests {
"aabbccddaabbccddaabbccddaabbccddaabbccddaabbccddaabbccddaabbccdd",
)
.unwrap(),
relayer: Addr::unchecked("relayer"),
},
};
let ser = to_vec(&msg).unwrap();
assert_eq!(
ser,
br#"{"nois_receive":{"callback":{"job_id":"first","published":"1682086395000000000","randomness":"aabbccddaabbccddaabbccddaabbccddaabbccddaabbccddaabbccddaabbccdd"}}}"#
br#"{"nois_receive":{"callback":{"job_id":"first","published":"1682086395000000000","randomness":"aabbccddaabbccddaabbccddaabbccddaabbccddaabbccddaabbccddaabbccdd","relayer":"relayer"}}}"#
);
}
}