Skip to content

Error on unsafeRandom() call in v1.3.4+ #1174

Description

@sisyphusSmiling

Problem

Calls to unsafeRandom() result in error. Bug persists in 1.3.4 & 1.4.0.

Steps to Reproduce

Execute the following script with the CLI versions 1.3.4 or 1.4.0

pub fun main(): UInt64 {
    return unsafeRandom()
}

Which will result in the following error:

❌ Command Error: client: rpc error: code = Unknown desc = [Error Code: 1057] error caused by: 1 error occurred:
	* [Error Code: 1101] cadence runtime error: Execution failed:
error: internal error: [Error Code: 1057] operation (Random) is not supported in this environment

Acceptance Criteria

The unsafeRandom API is still active (though undergoing refactor) so the call should function as it does with version 1.3.3 and older.

Context

Not currently blocked - using v1.3.3 instead - but came up when running Cadence tests locally.

Metadata

Metadata

Assignees

Labels

BugThe issue represents a bug, malfunction, regressionFeedback

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions