Skip to content

Commit

Permalink
Update Wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
BugFreeSoftware committed Feb 27, 2024
1 parent 5469abb commit e679211
Show file tree
Hide file tree
Showing 16 changed files with 3,558 additions and 3,795 deletions.
7,050 changes: 3,525 additions & 3,525 deletions contracts/wasm/package-lock.json

Large diffs are not rendered by default.

Binary file modified documentation/tutorial-examples/test/solotutorial_bg.wasm
Binary file not shown.
Binary file modified packages/vm/core/testcore/sbtests/sbtestsc/testcore_bg.wasm
Binary file not shown.
20 changes: 8 additions & 12 deletions packages/wasmvm/wasmlib/as/wasmlib/coreblocklog/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,15 @@ export const ParamFromBlock = 'f';
export const ParamRequestID = 'u';
export const ParamToBlock = 't';

export const ResultBlockIndex = 'n';
export const ResultBlockInfo = 'i';
export const ResultEvent = 'e';
export const ResultGoverningAddress = 'g';
export const ResultRequestID = 'u';
export const ResultRequestIndex = 'r';
export const ResultRequestProcessed = 'p';
export const ResultRequestReceipt = 'd';
export const ResultRequestReceipts = 'd';
export const ResultStateControllerAddress = 's';
export const ResultBlockIndex = 'n';
export const ResultBlockInfo = 'i';
export const ResultEvent = 'e';
export const ResultRequestID = 'u';
export const ResultRequestIndex = 'r';
export const ResultRequestProcessed = 'p';
export const ResultRequestReceipt = 'd';
export const ResultRequestReceipts = 'd';

export const ViewControlAddresses = 'controlAddresses';
export const ViewGetBlockInfo = 'getBlockInfo';
export const ViewGetEventsForBlock = 'getEventsForBlock';
export const ViewGetEventsForContract = 'getEventsForContract';
Expand All @@ -36,7 +33,6 @@ export const ViewGetRequestReceipt = 'getRequestReceipt';
export const ViewGetRequestReceiptsForBlock = 'getRequestReceiptsForBlock';
export const ViewIsRequestProcessed = 'isRequestProcessed';

export const HViewControlAddresses = new wasmtypes.ScHname(0x796bd223);
export const HViewGetBlockInfo = new wasmtypes.ScHname(0xbe89f9b3);
export const HViewGetEventsForBlock = new wasmtypes.ScHname(0x36232798);
export const HViewGetEventsForContract = new wasmtypes.ScHname(0x682a1922);
Expand Down
16 changes: 0 additions & 16 deletions packages/wasmvm/wasmlib/as/wasmlib/coreblocklog/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@
import * as wasmlib from '../index';
import * as sc from './index';

export class ControlAddressesCall {
func: wasmlib.ScView;
results: sc.ImmutableControlAddressesResults = new sc.ImmutableControlAddressesResults(wasmlib.ScView.nilProxy);

public constructor(ctx: wasmlib.ScViewClientContext) {
this.func = new wasmlib.ScView(ctx, sc.HScName, sc.HViewControlAddresses);
}
}

export class GetBlockInfoCall {
func: wasmlib.ScView;
params: sc.MutableGetBlockInfoParams = new sc.MutableGetBlockInfoParams(wasmlib.ScView.nilProxy);
Expand Down Expand Up @@ -96,13 +87,6 @@ export class IsRequestProcessedCall {
}

export class ScFuncs {
// Returns the current state controller and governing addresses and at what block index they were set.
static controlAddresses(ctx: wasmlib.ScViewClientContext): ControlAddressesCall {
const f = new ControlAddressesCall(ctx);
f.results = new sc.ImmutableControlAddressesResults(wasmlib.newCallResultsProxy(f.func));
return f;
}

// Returns information about the given block.
static getBlockInfo(ctx: wasmlib.ScViewClientContext): GetBlockInfoCall {
const f = new GetBlockInfoCall(ctx);
Expand Down
34 changes: 0 additions & 34 deletions packages/wasmvm/wasmlib/as/wasmlib/coreblocklog/results.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,6 @@
import * as wasmtypes from '../wasmtypes';
import * as sc from './index';

export class ImmutableControlAddressesResults extends wasmtypes.ScProxy {
// index of block where the addresses were set
blockIndex(): wasmtypes.ScImmutableUint32 {
return new wasmtypes.ScImmutableUint32(this.proxy.root(sc.ResultBlockIndex));
}

// governing address
governingAddress(): wasmtypes.ScImmutableAddress {
return new wasmtypes.ScImmutableAddress(this.proxy.root(sc.ResultGoverningAddress));
}

// state controller address
stateControllerAddress(): wasmtypes.ScImmutableAddress {
return new wasmtypes.ScImmutableAddress(this.proxy.root(sc.ResultStateControllerAddress));
}
}

export class MutableControlAddressesResults extends wasmtypes.ScProxy {
// index of block where the addresses were set
blockIndex(): wasmtypes.ScMutableUint32 {
return new wasmtypes.ScMutableUint32(this.proxy.root(sc.ResultBlockIndex));
}

// governing address
governingAddress(): wasmtypes.ScMutableAddress {
return new wasmtypes.ScMutableAddress(this.proxy.root(sc.ResultGoverningAddress));
}

// state controller address
stateControllerAddress(): wasmtypes.ScMutableAddress {
return new wasmtypes.ScMutableAddress(this.proxy.root(sc.ResultStateControllerAddress));
}
}

export class ImmutableGetBlockInfoResults extends wasmtypes.ScProxy {
// index of returned block
blockIndex(): wasmtypes.ScImmutableUint32 {
Expand Down
20 changes: 8 additions & 12 deletions packages/wasmvm/wasmlib/go/wasmlib/coreblocklog/consts.go

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

14 changes: 0 additions & 14 deletions packages/wasmvm/wasmlib/go/wasmlib/coreblocklog/contract.go

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

42 changes: 0 additions & 42 deletions packages/wasmvm/wasmlib/go/wasmlib/coreblocklog/results.go

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

22 changes: 9 additions & 13 deletions packages/wasmvm/wasmlib/src/coreblocklog/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,15 @@ pub(crate) const PARAM_FROM_BLOCK : &str = "f";
pub(crate) const PARAM_REQUEST_ID : &str = "u";
pub(crate) const PARAM_TO_BLOCK : &str = "t";

pub(crate) const RESULT_BLOCK_INDEX : &str = "n";
pub(crate) const RESULT_BLOCK_INFO : &str = "i";
pub(crate) const RESULT_EVENT : &str = "e";
pub(crate) const RESULT_GOVERNING_ADDRESS : &str = "g";
pub(crate) const RESULT_REQUEST_ID : &str = "u";
pub(crate) const RESULT_REQUEST_INDEX : &str = "r";
pub(crate) const RESULT_REQUEST_PROCESSED : &str = "p";
pub(crate) const RESULT_REQUEST_RECEIPT : &str = "d";
pub(crate) const RESULT_REQUEST_RECEIPTS : &str = "d";
pub(crate) const RESULT_STATE_CONTROLLER_ADDRESS : &str = "s";

pub(crate) const VIEW_CONTROL_ADDRESSES : &str = "controlAddresses";
pub(crate) const RESULT_BLOCK_INDEX : &str = "n";
pub(crate) const RESULT_BLOCK_INFO : &str = "i";
pub(crate) const RESULT_EVENT : &str = "e";
pub(crate) const RESULT_REQUEST_ID : &str = "u";
pub(crate) const RESULT_REQUEST_INDEX : &str = "r";
pub(crate) const RESULT_REQUEST_PROCESSED : &str = "p";
pub(crate) const RESULT_REQUEST_RECEIPT : &str = "d";
pub(crate) const RESULT_REQUEST_RECEIPTS : &str = "d";

pub(crate) const VIEW_GET_BLOCK_INFO : &str = "getBlockInfo";
pub(crate) const VIEW_GET_EVENTS_FOR_BLOCK : &str = "getEventsForBlock";
pub(crate) const VIEW_GET_EVENTS_FOR_CONTRACT : &str = "getEventsForContract";
Expand All @@ -38,7 +35,6 @@ pub(crate) const VIEW_GET_REQUEST_RECEIPT : &str = "getRequestReceipt
pub(crate) const VIEW_GET_REQUEST_RECEIPTS_FOR_BLOCK : &str = "getRequestReceiptsForBlock";
pub(crate) const VIEW_IS_REQUEST_PROCESSED : &str = "isRequestProcessed";

pub(crate) const HVIEW_CONTROL_ADDRESSES : ScHname = ScHname(0x796bd223);
pub(crate) const HVIEW_GET_BLOCK_INFO : ScHname = ScHname(0xbe89f9b3);
pub(crate) const HVIEW_GET_EVENTS_FOR_BLOCK : ScHname = ScHname(0x36232798);
pub(crate) const HVIEW_GET_EVENTS_FOR_CONTRACT : ScHname = ScHname(0x682a1922);
Expand Down
15 changes: 0 additions & 15 deletions packages/wasmvm/wasmlib/src/coreblocklog/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
use crate::*;
use crate::coreblocklog::*;

pub struct ControlAddressesCall<'a> {
pub func: ScView<'a>,
pub results: ImmutableControlAddressesResults,
}

pub struct GetBlockInfoCall<'a> {
pub func: ScView<'a>,
pub params: MutableGetBlockInfoParams,
Expand Down Expand Up @@ -65,16 +60,6 @@ pub struct ScFuncs {
}

impl ScFuncs {
// Returns the current state controller and governing addresses and at what block index they were set.
pub fn control_addresses(ctx: &impl ScViewClientContext) -> ControlAddressesCall {
let mut f = ControlAddressesCall {
func: ScView::new(ctx, HSC_NAME, HVIEW_CONTROL_ADDRESSES),
results: ImmutableControlAddressesResults { proxy: Proxy::nil() },
};
ScView::link_results(&mut f.results.proxy, &f.func);
f
}

// Returns information about the given block.
pub fn get_block_info(ctx: &impl ScViewClientContext) -> GetBlockInfoCall {
let mut f = GetBlockInfoCall {
Expand Down
50 changes: 0 additions & 50 deletions packages/wasmvm/wasmlib/src/coreblocklog/results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,56 +9,6 @@
use crate::*;
use crate::coreblocklog::*;

#[derive(Clone)]
pub struct ImmutableControlAddressesResults {
pub proxy: Proxy,
}

impl ImmutableControlAddressesResults {
// index of block where the addresses were set
pub fn block_index(&self) -> ScImmutableUint32 {
ScImmutableUint32::new(self.proxy.root(RESULT_BLOCK_INDEX))
}

// governing address
pub fn governing_address(&self) -> ScImmutableAddress {
ScImmutableAddress::new(self.proxy.root(RESULT_GOVERNING_ADDRESS))
}

// state controller address
pub fn state_controller_address(&self) -> ScImmutableAddress {
ScImmutableAddress::new(self.proxy.root(RESULT_STATE_CONTROLLER_ADDRESS))
}
}

#[derive(Clone)]
pub struct MutableControlAddressesResults {
pub proxy: Proxy,
}

impl MutableControlAddressesResults {
pub fn new() -> MutableControlAddressesResults {
MutableControlAddressesResults {
proxy: results_proxy(),
}
}

// index of block where the addresses were set
pub fn block_index(&self) -> ScMutableUint32 {
ScMutableUint32::new(self.proxy.root(RESULT_BLOCK_INDEX))
}

// governing address
pub fn governing_address(&self) -> ScMutableAddress {
ScMutableAddress::new(self.proxy.root(RESULT_GOVERNING_ADDRESS))
}

// state controller address
pub fn state_controller_address(&self) -> ScMutableAddress {
ScMutableAddress::new(self.proxy.root(RESULT_STATE_CONTROLLER_ADDRESS))
}
}

#[derive(Clone)]
pub struct ImmutableGetBlockInfoResults {
pub proxy: Proxy,
Expand Down
20 changes: 8 additions & 12 deletions packages/wasmvm/wasmlib/ts/wasmlib/coreblocklog/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,15 @@ export const ParamFromBlock = 'f';
export const ParamRequestID = 'u';
export const ParamToBlock = 't';

export const ResultBlockIndex = 'n';
export const ResultBlockInfo = 'i';
export const ResultEvent = 'e';
export const ResultGoverningAddress = 'g';
export const ResultRequestID = 'u';
export const ResultRequestIndex = 'r';
export const ResultRequestProcessed = 'p';
export const ResultRequestReceipt = 'd';
export const ResultRequestReceipts = 'd';
export const ResultStateControllerAddress = 's';
export const ResultBlockIndex = 'n';
export const ResultBlockInfo = 'i';
export const ResultEvent = 'e';
export const ResultRequestID = 'u';
export const ResultRequestIndex = 'r';
export const ResultRequestProcessed = 'p';
export const ResultRequestReceipt = 'd';
export const ResultRequestReceipts = 'd';

export const ViewControlAddresses = 'controlAddresses';
export const ViewGetBlockInfo = 'getBlockInfo';
export const ViewGetEventsForBlock = 'getEventsForBlock';
export const ViewGetEventsForContract = 'getEventsForContract';
Expand All @@ -36,7 +33,6 @@ export const ViewGetRequestReceipt = 'getRequestReceipt';
export const ViewGetRequestReceiptsForBlock = 'getRequestReceiptsForBlock';
export const ViewIsRequestProcessed = 'isRequestProcessed';

export const HViewControlAddresses = new wasmtypes.ScHname(0x796bd223);
export const HViewGetBlockInfo = new wasmtypes.ScHname(0xbe89f9b3);
export const HViewGetEventsForBlock = new wasmtypes.ScHname(0x36232798);
export const HViewGetEventsForContract = new wasmtypes.ScHname(0x682a1922);
Expand Down
Loading

0 comments on commit e679211

Please sign in to comment.