Skip to content

Instantly share code, notes, and snippets.

@michaeljklein
Created September 10, 2019 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaeljklein/69f6a8c23bfc5a8d448b4c13df7c2d4b to your computer and use it in GitHub Desktop.
Save michaeljklein/69f6a8c23bfc5a8d448b4c13df7c2d4b to your computer and use it in GitHub Desktop.
Test on alphanet, demonstrating lack of support for SELF in lambda's
parameter (contract address);
storage unit;
code
{
UNPAIR;
DIP { DIP { LAMBDA unit address { DROP; SELF } }; EXEC };
SWAP;
DIP { AMOUNT };
TRANSFER_TOKENS;
DIP { NIL };
CONS;
DIP { UNIT };
}
# To test:
#
# ❯❯❯ alias alpha-client="tezos-client -A rpcalpha.tzbeta.net -P 443 -S"
#
# ❯❯❯ alpha-client originate contract LambdaSelfTest for alice transferring 0 \
# from alice running "$(cat LambdaSelfTest.tz)" --dry-run
# Warning:
#
# This is NOT the Tezos Mainnet.
#
# The node you are connecting to claims to be running on the
# Tezos Alphanet DEVELOPMENT NETWORK.
# Do NOT use your fundraiser keys on this network.
# Alphanet is a testing network, with free tokens.
#
# Waiting for the node to be bootstrapped before injection...
# Current head: BMYMFeJPZC4X (timestamp: 2019-09-10T19:04:26-00:00, validation: 2019-09-10T19:04:49-00:00)
# Node is bootstrapped, ready for injecting operations.
# This simulation failed:
# Manager signed operations:
# From: tz1L2UAwwU4k2nxjzB2mTnxW61wCcWaZeYkp
# Fee to the baker: ꜩ0
# Expected counter: 823882
# Gas limit: 800000
# Storage limit: 60000 bytes
# Origination:
# From: tz1L2UAwwU4k2nxjzB2mTnxW61wCcWaZeYkp
# For: tz1L2UAwwU4k2nxjzB2mTnxW61wCcWaZeYkp
# Credit: ꜩ0
# Script:
# { parameter (contract address) ;
# storage unit ;
# code { UNPAIR ;
# DIP { DIP { LAMBDA unit address { DROP ; SELF } } ; EXEC } ;
# SWAP ;
# DIP { AMOUNT } ;
# TRANSFER_TOKENS ;
# DIP { NIL } ;
# CONS ;
# DIP { UNIT } } }
# Initial storage: Unit
# No delegate for this contract
# This operation FAILED.
#
# Ill typed contract:
# 01: { parameter (contract address) ;
# 02: storage unit ;
# 03: code { UNPAIR ;
# 04: DIP { DIP { LAMBDA unit address { DROP ; SELF } } ; EXEC } ;
# 05: SWAP ;
# 06: DIP { AMOUNT } ;
# 07: TRANSFER_TOKENS ;
# 08: DIP { NIL } ;
# 09: CONS ;
# 10: DIP { UNIT } } }
# At line 4 characters 50 to 54,
# The SELF instruction cannot appear in a lambda.
# Fatal error:
# origination simulation failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment