Skip to content

Commit

Permalink
Merge branch 'develop' into snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
Juliusan committed Aug 16, 2023
2 parents 5aa85a7 + 5227881 commit 05af6f5
Show file tree
Hide file tree
Showing 59 changed files with 1,409 additions and 889 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
name: Publish @iota/iscmagic
name: Publish @iota NPM packages

on:
workflow_call:
inputs:
version:
required: true
type: string
workingDirectory:
required: true
type: string
secrets:
NPM_TOKEN:
required: true
Expand All @@ -15,18 +18,18 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./packages/vm/core/evm/iscmagic
working-directory: ${{ inputs.workingDirectory }}
steps:
- uses: actions/checkout@v3
-
-
uses: actions/setup-node@v3
with:
node-version: lts/*
registry-url: 'https://registry.npmjs.org'
scope: iota
-
-
run: npm version ${{ inputs.version }}
-
-
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,16 @@ jobs:
build-args: |
BUILD_LD_FLAGS=-X=github.com/iotaledger/wasp/components/app.Version=${{ steps.tagger.outputs.tag }}
release-iscmagic:
uses: ./.github/workflows/publish-iscmagic.yml

release-npm-packacges:
needs: release-docker
with:
version: ${{ needs.release-docker.outputs.version }}
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
runs-on: ubuntu-latest
strategy:
matrix:
workingDirectory: ['./packages/vm/core/evm/iscmagic', './tools/evm/iscutils']
steps:
- name: Release NPM package
uses: ./.github/workflows/publish-npm.yml
with:
version: ${{ needs.release-docker.outputs.version }}
workingDirectory: ${{ matrix.workingDirectory }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
ARG GOLANG_IMAGE_TAG=1.20-bullseye
ARG GOLANG_IMAGE_TAG=1.21-bullseye

# Build stage
FROM golang:${GOLANG_IMAGE_TAG} AS build
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.noncached
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
ARG GOLANG_IMAGE_TAG=1.20-bullseye
ARG GOLANG_IMAGE_TAG=1.21-bullseye

# Build stage
FROM golang:${GOLANG_IMAGE_TAG} AS build
Expand Down
17 changes: 17 additions & 0 deletions contracts/wasm/testwasmlib/go/testwasmlibimpl/funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -793,3 +793,20 @@ func viewCheckEthEmptyAddressAndAgentID(ctx wasmlib.ScViewContext, f *CheckEthEm
func viewCheckEthInvalidEmptyAddressFromString(_ wasmlib.ScViewContext, _ *CheckEthInvalidEmptyAddressFromStringContext) {
_ = wasmtypes.AddressFromString("0x00")
}

func funcActivate(ctx wasmlib.ScFuncContext, f *ActivateContext) {
f.State.Active().SetValue(true)
deposit := ctx.Allowance().BaseTokens()
transfer := wasmlib.ScTransferFromBaseTokens(deposit)
ctx.TransferAllowed(ctx.AccountID(), transfer)
delay := f.Params.Seconds().Value()
testwasmlib.ScFuncs.Deactivate(ctx).Func.Delay(delay).Post()
}

func funcDeactivate(_ wasmlib.ScFuncContext, f *DeactivateContext) {
f.State.Active().SetValue(false)
}

func viewGetActive(_ wasmlib.ScViewContext, f *GetActiveContext) {
f.Results.Active().SetValue(f.State.Active().Value())
}
17 changes: 17 additions & 0 deletions contracts/wasm/testwasmlib/rs/testwasmlibimpl/src/funcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1351,3 +1351,20 @@ pub fn view_check_eth_invalid_empty_address_from_string(
) {
address_from_string("0x00");
}

pub fn func_activate(ctx: &ScFuncContext, f: &ActivateContext) {
f.state.active().set_value(true);
let deposit = ctx.allowance().base_tokens();
let transfer = wasmlib::ScTransfer::base_tokens(deposit);
ctx.transfer_allowed(&ctx.account_id(), &transfer);
let delay = f.params.seconds().value();
testwasmlib::ScFuncs::deactivate(ctx).func.delay(delay).post();
}

pub fn func_deactivate(ctx: &ScFuncContext, f: &DeactivateContext) {
f.state.active().set_value(false);
}

pub fn view_get_active(ctx: &ScViewContext, f: &GetActiveContext) {
f.results.active().set_value(f.state.active().value());
}
12 changes: 12 additions & 0 deletions contracts/wasm/testwasmlib/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ typedefs:
# ##################################

state:
active: Bool
# basic datatypes, using String
arrayOfStringArray: StringArray[]
arrayOfStringMap: StringMap[]
Expand All @@ -75,6 +76,13 @@ state:
# ##################################

funcs:
activate:
params:
seconds: Uint32

deactivate:
access: self # only SC itself can invoke this function

stringMapOfStringArrayAppend:
params:
name: String
Expand Down Expand Up @@ -208,6 +216,10 @@ funcs:
# ##################################

views:
getActive:
results:
active: Bool

stringMapOfStringArrayLength:
params:
name: String
Expand Down
49 changes: 49 additions & 0 deletions contracts/wasm/testwasmlib/test/testwasmlib_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,55 @@ func newClient(t testing.TB, svcClient wasmclient.IClientService, wallet *crypto
return ctx
}

func TestTimedDeactivation(t *testing.T) {
if !useDisposable && !useCluster {
t.SkipNow()
}

var ctxCluster *wasmclient.WasmClientContext
if useCluster {
ctxCluster = setupClient(t)
}

ctx := setupClientLib(t)
require.NoError(t, ctx.Err)

active := getActive(t, ctx)
require.False(t, active)

f := testwasmlib.ScFuncs.Activate(ctx)
f.Params.Seconds().SetValue(420)
f.Func.TransferBaseTokens(2_000_000).AllowanceBaseTokens(1_000_000).Post()
require.NoError(t, ctx.Err)

ctx.WaitRequest()
require.NoError(t, ctx.Err)

for i := 0; i < 100; i++ {
active = getActive(t, ctx)
seconds := 20
fmt.Printf("TICK #%d: %v\n", i*seconds, active)
if !active {
break
}
factor := time.Duration(seconds)
if useCluster {
// time marches 10x faster
factor /= 10
}
time.Sleep(factor * time.Second)
}

_ = ctxCluster
}

func getActive(t *testing.T, ctx *wasmclient.WasmClientContext) bool {
a := testwasmlib.ScFuncs.GetActive(ctx)
a.Func.Call()
require.NoError(t, ctx.Err)
return a.Results.Active().Value()
}

func TestClientAccountBalance(t *testing.T) {
ctx := setupClient(t)
wallet := ctx.CurrentKeyPair()
Expand Down
17 changes: 17 additions & 0 deletions contracts/wasm/testwasmlib/ts/testwasmlibimpl/funcs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -780,3 +780,20 @@ export function viewCheckEthEmptyAddressAndAgentID(ctx: wasmlib.ScViewContext, f
export function viewCheckEthInvalidEmptyAddressFromString(ctx: wasmlib.ScViewContext, f: sc.CheckEthInvalidEmptyAddressFromStringContext): void {
wasmtypes.addressFromString("0x00");
}

export function funcActivate(ctx: wasmlib.ScFuncContext, f: sc.ActivateContext): void {
f.state.active().setValue(true);
const deposit = ctx.allowance().baseTokens();
const transfer = wasmlib.ScTransfer.baseTokens(deposit);
ctx.transferAllowed(ctx.accountID(), transfer);
const delay = f.params.seconds().value();
sc.ScFuncs.deactivate(ctx).func.delay(delay).post();
}

export function funcDeactivate(ctx: wasmlib.ScFuncContext, f: sc.DeactivateContext): void {
f.state.active().setValue(false);
}

export function viewGetActive(ctx: wasmlib.ScViewContext, f: sc.GetActiveContext): void {
f.results.active().setValue(f.state.active().value());
}
Binary file modified documentation/tutorial-examples/test/solotutorial_bg.wasm
Binary file not shown.
19 changes: 19 additions & 0 deletions packages/authentication/auth_context.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package authentication

import "github.com/labstack/echo/v4"

type AuthContext struct {
echo.Context

scheme string
claims *WaspClaims
name string
}

func (a *AuthContext) Name() string {
return a.name
}

func (a *AuthContext) Scheme() string {
return a.scheme
}
35 changes: 0 additions & 35 deletions packages/authentication/basic_auth.go

This file was deleted.

44 changes: 0 additions & 44 deletions packages/authentication/context.go

This file was deleted.

53 changes: 0 additions & 53 deletions packages/authentication/ip_whitelist.go

This file was deleted.

Loading

0 comments on commit 05af6f5

Please sign in to comment.