While trying to deploy contracts locally I am getting the below error.
Error: *** Deployment Failed ***
"ABCContract" -- Returned error: base fee exceeds gas limit.
I have tried to manipulate the gas in Ganache GUI but this error is still occurring. Below is my truffle config.
require('babel-register')
require('babel-polyfill')
module.exports = {
networks: {
development: {
host: '127.0.0.1',
port: 7545,
network_id: '*', // Match any network id
},
},
contracts_directory: './src/contracts/',
contracts_build_directory: './src/abis/',
compilers: {
solc: {
version: '0.8.9',
optimizer: {
enabled: true,
runs: 200,
},
evmVersion: 'petersburg',
},
},
}
In Ganache I have set GAS LIMIT: 6721975 and GAS PRICE: 20000000000
UPDATE
It turns out that if I remove some of my methods I am able to deploy the contract but apart from that I am getting the above error.
Another Update
I got the main reason why this error is occurring. It is because I am using mint function in my constructor and that mint is causing this problem. When I commented that function the problem is solved. Don't know why but it is causing the problem.
Last and final update
Turns out it was a programming mistake. I called the mint function inside the mint function instead of the ERC _mint function and it goes into recursion forever which caused this problem.
Related
I am exploring tools I can use for automated Accessibility Testing and wanted to try axe-core with TestCafe. I am an advocate of TestCafe, I love that is a lightweight tool and doesn't have dependencies on WebDriver. The docs are great and the scripting is easy.
I have however found that #testcafe-community/axe and its predecessor axe-testcafe do not report all violations while axe-core with selenium and axe-webdriverjs do. For example, running with axe-webdriverjs, I have the following code and resulting output showing the violations of a localhost page I am checking -
Code:
var AxeBuilder = require('axe-webdriverjs');
var WebDriver = require('selenium-webdriver');
const path = require('path');
process.env.PATH = path.resolve(`__dirname/../WebDriver/bin/Firefox/0.29.1`) + ':' + process.env.PATH;
var driver = new WebDriver.Builder()
.forBrowser('firefox')
.build();
driver
//.get('https://dequeuniversity.com/demo/mars/')
.get('http://localhost:3000')
.then(function() {
AxeBuilder(driver).analyze(function(err, results) {
if (err) {
// Handle error somehow
}
console.log(results.violations);
});
});
Output:
> axe-webdriverjs-tests#1.0.0 test1 /Users/nabeen.jamal/gitlab.com/notifications-service/text-messaging-application/tma-test/app/axe-webdriverjs-tests
> node test/axe.test1.js
[
{
description: 'Ensures all page content is contained by landmarks',
help: 'All page content must be contained by landmarks',
helpUrl: 'https://dequeuniversity.com/rules/axe/3.5/region?application=webdriverjs',
id: 'region',
impact: 'moderate',
nodes: [ [Object], [Object] ],
tags: [ 'cat.keyboard', 'best-practice' ]
}
]
Using #testcafe-community/axe and following the 'How to use' on the project github page (https://github.com/testcafe-community/axe), I have the following code and resulting output which shows no violations of the same localhost page.
Code:
import { checkForViolations } from '#testcafe-community/axe';
fixture `TestCafe tests with Axe`
//.page `http://example.com`;
.page `http://localhost:3000`;
test('Automated accessibility testing', async t => {
// do stuff on your page
await checkForViolations(t);
});
Output:
nabeen.jamal#DEM-C02DFG1UMD6M axe-testcafe-tests % npx testcafe --config-file cfg/testcaferc.json chrome src/test1.js
(node:88006) ExperimentalWarning: Conditional exports is an experimental feature. This feature could change at any time
(node:88006) ExperimentalWarning: Package name self resolution is an experimental feature. This feature could change at any time
Running tests in:
- Chrome 90.0.4430.212 / macOS 10.15.7
TestCafe tests with Axe
✓ Automated accessibility testing
1 passed (0s)
As the output shows, the #testcafe-community/axe test passes and shows no violations while the axe-webdriverjs (and axe-core with selenium) shows the violation about "all page content contained by landmarks".
Is this a limitation in #testcafe-community/axe, or do you have to specify the rules in the options parameter of axe.run for it to carry out the checks on the rendered content of the loaded page?
The documentation for axe-core states that you need to specify which rules you intend to test against using axe.run options.
Landmarks are discussed in WCAG 1.3.6., which is a "Level AAA" item. It appears that axe-core is only capable of testing against "Level A" and "Level AA." In your example, the item is not listed by the tool as a WCAG failure, but rather a best-practices recommendation. This may be why it isn't showing up in your other tools.
If you can easily implement this recommendation, then I'd say go ahead and do it. If not, I wouldn't let something like this stop my code from going into production. Landmarks are nice-to-have, but it's far more important that you meet all "Level A" requirements and as many "Level AA" requirements as you reasonably can.
It's worth noting that any automated accessibility testing tool is nothing more than a starting point for manual evaluation. These tools often generate tons of false positives (and sometimes miss important things!) because it's often not possible to algorithmically determine whether something is genuinely useful to human visitors.
I've also seen pages/apps that pass automated tools with no errors (Wave, Axe, etc.), but they are completely impossible to use with assistive technology.
I'm not 100% certain how, but my tests using axe-testcafe and #testcafe-community/axe are now showing the violation -
Running tests in:
- Chrome 90.0.4430.212 / macOS 10.15.7
TestCafe tests with Axe
✓ Verify Welcome Page loads properly
✖ Automated accessibility testing
1) AssertionError: 1 violations found:
1) All page content must be contained by landmarks
* https://dequeuniversity.com/rules/axe/3.5/region?application=axeAPI
* cat.keyboard, best-practice
* moderate
* region
"#global-cookie-message"
".app-phase-banner"
: expected false to be truthy
Browser: Chrome 90.0.4430.212 / macOS 10.15.7
67 |const checkForViolations = async (t, context, options) => {
68 | const { error, results } = await axeCheck(t, context, options);
69 |
70 | await t.expect(error).notOk();
71 |
> 72 | await t.expect(results.violations.length === 0).ok(createReport(results.violations));
73 |}
74 |
75 |
76 |module.exports = {
77 | runAxe,
at checkForViolations
(/Users/nabeen.jamal/gitlab.com/notifications-service/text-messaging-application/tma-test/app/axe-testcafe-tests/node_modules/#testcafe-community/axe/index.js:72:53)
1/2 failed (1s)
I didn't have to specify the rules in the options parameter to axe.run - I did do so, but with or without, the violation does now get reported.
I did however uninstall and reinstall the node packages and I think the version of axe-core is different to what I had previously. Here are my dependencies and the versions in my package.json that work for me -
{
"name": "axe-testcafe-tests",
"version": "1.0.0",
"description": "axe-core and TestCafe testware to cover Accesibility Testing of the TMA App",
"main": "index.js",
"dependencies": {
"testcafe": "^1.14.2"
},
"devDependencies": {
"#testcafe-community/axe": "^3.5.0",
"axe-core": "^3.5.5",
"axe-testcafe": "^3.0.0"
},
<-- snip -->
Thank you again #Josh for your help. Perhaps this might help others.
1. Problem
I am running npm start which is building my react-firebase application, which compiles fine but when I look at my app on localhost I receive this error:
Build Stack Trace
2. What I've Done
I tried to follow suggestions in this Github post.
I noticed that by going to node_modules/#firebase/firestore/dist/index.cjs.js:27457:21 and changing firebase.INTERNAL.registerComponent to firebase.INTERNAL.registerComponent this changed the error to TypeError: instance.registerVersion is not a function which makes me believe that there must be some issue with my version of firebase.
I have tried to revert firebase to version 7.6.0 since there was a recent update made on 01/09/2020 to no avail.
I tried doing all the installing of dependencies in a virtual environment just in case, for some reason, there were some discrepancies between projects
First Error Location:
function configureForFirebase(firebase) {
firebase.INTERNAL.registerComponent(new component.Component('firestore', function (container) {
var app = container.getProvider('app').getImmediate();
return new Firestore(app, container.getProvider('auth-internal'));
}, "PUBLIC" /* PUBLIC */).setServiceProps(shallowCopy(firestoreNamespace)));
}
Second Error location:
function registerFirestore(instance) {
configureForFirebase(instance);
instance.registerVersion(name, version);
}
I've inherited a simple site with staging and production projects living on Google App Engine. Yesterday made a simple deploy to staging (using CircleCI), the first deploy since January. Since then the site won't load and the logs show an exception we haven't had before:
"Cannot read property 'parsePath' of undefined" when trying to go to the home page at: /
Our code does not make any call to 'parsePath', so it must be some underlying machinery.
I reverted the code change and re-pushed the staging branch with the code that's been live since January (and is live and error-free right now in production), deploy was successful, but the same symptom is there still in staging! (Needless to say, we can't deploy anything to production until we know what the heck is going on)
I've been looking through the circleCI deploy logs for clues- one difference is during the "gcloud auth activate-service-account" step, it wasn't able to update the compute/zone property (but the build still succeeded):
Updated property [core/project].
WARNING: You do not appear to have access to project [veryloudstatic] or it does not exist.
Updated property [compute/zone].
What should I be looking at on the GAE side? Has anyone seen this exception before, or know enough about how GAE works to suggest places to troubleshoot? We haven't made any changes to these GAE projects in the past few months, so I'm wondering if some internal updates could be the issue?
Cannot read property 'parsePath' of undefined
Expand all | Collapse all {
insertId: "owonpfihz4box5kp7"
labels: {
appengine.googleapis.com/instance_name: "aef-default-20190620t195308-lsn2"
compute.googleapis.com/resource_id: "2700574583511472701"
compute.googleapis.com/resource_name: "b6282fd5dc84"
compute.googleapis.com/zone: "us-central1-f"
}
logName: "projects/veryloudstatic/logs/appengine.googleapis.com%2Fstderr"
receiveTimestamp: "2019-06-21T13:53:47.746443513Z"
resource: {
labels: {
module_id: "default"
project_id: "veryloudstatic"
version_id: "20190620t195308"
}
type: "gae_app"
}
textPayload: "Cannot read property 'parsePath' of undefined
"
timestamp: "2019-06-21T13:53:45Z"
}
35.233.167.246 - "GET /" 500 148 "-" "GoogleStackdriverMonitoring-UptimeChecks(https://cloud.google.com/monitoring)"
Expand all | Collapse all {
httpRequest: {
latency: "0.166s"
referer: "-"
remoteIp: "35.233.167.246"
requestMethod: "GET"
requestUrl: "/"
responseSize: "148"
status: 500
userAgent: "GoogleStackdriverMonitoring-UptimeChecks(https://cloud.google.com/monitoring)"
}
insertId: "28alo0fexgmee"
jsonPayload: {…}
labels: {…}
logName: "projects/veryloudstatic/logs/appengine.googleapis.com%2Fnginx.request"
receiveTimestamp: "2019-06-21T13:53:47.746443513Z"
resource: {…}
timestamp: "2019-06-21T13:53:45.536Z"
trace: "projects/veryloudstatic/traces/5190f7942330e15370ff65d1c79c5963"
}
Without more of a stack trace its hard to tell, but check your dependency versions if there are any. An underlying dependency may have updated. Make sure to check both your app code and the CircleCI base image.
Using AngularJS-1.6.5 & Angular-ui-router-1.0.6 && Gulp-3.9.1
I'm having this absolutely annoying issue. I have an angular app that seems to build fine but when I run gulp-connect to run it, I keep getting failed to load template errors in this order:
vendor.js:14803 Error: [$compile:tpload] Failed to load template: app/auth/views/login.tpl.html (HTTP status: undefined undefined)
vendor.js:34081 Transition Rejection($id: 0 type: 6, message: The transition errored, detail: Error: [$compile:tpload] Failed to load template: app/auth/views/login.tpl.html (HTTP status: undefined undefined)
Error: [$compile:tpload] Failed to load template: app/auth/views/login.tpl.html (HTTP status: undefined undefined)
If I run my gulp build process and then use something like httpster to provide the server, the page comes up fine with no error. However, when I add gulp-connect to my build process:
gulp.task("connect",["css", "vendor", "js", "watch", "webWorkers"], function
() {
connect.server({
port: 8888
});
});
I get the errors above.
This was working just a day ago and for whatever reason, even previous versions that worked are no longer working either. I've tried redirecting to another template, verified that all entries are in template cache, tried retrieving a file that was on network instead of the template cache, uninstall/reinstalling gulp-connect and nothing has worked. I'm just completely stumped at this point and need to figure something out soon for the sake of my sanity.
Any thoughts would be greatly appreciated.
Goodness. After a bunch of trial and error, I finally figured out the issue. The issue was actually with an http interceptor that I was configuring with a token that was retrieved from local storage. The token retrieved from local storage was corrupt or invalid in some way (havent figured this issue out yet) and it was silently erroring out without bubbling the error up.
I wrapped the local storage read method in a try catch and now the templates are loading again.
Man I wasted so much time on this, hopefully this helps someone else out.
In my case, it it was a missed return config; statement when I add an interceptor to my app.
app.factory('loadingInterceptor', [
'$rootScope',
function ($rootScope)
{
return {
request: function (config)
{
var loadingEl = $(".loading-element");
if (loadingEl)
{
showLoading(loadingEl, true);
}
// return config;
},
response: function (response)
{
var loadingEl = $(".loading-element");
if (loadingEl) {
showLoading(loadingEl, false);
}
}
};
}
]);
hope this will help someone.
This also got me going for a while. In my case it was adding my view to the anonymousEndpoints config section.
anonymousEndpoints: ['clientapp/modules/login/login.view.html'],
adalProvider.init({
instance: 'https://*.microsoftonline.com/',
tenant: '*.onmicrosoft.com',
clientId: 'Some-long-guid',
anonymousEndpoints: ['clientapp/modules/login/login.view.html'],
extraQueryParameter: 'nux=1',
},$httpProvider);
Hope it helps someone down the road.
I have been setting up karma and jasmine on my angularjs 1.5 and jspm setup. Firstly all errors from karma the trace log is just coming from systemjs which makes it harder to debug. I am also getting a lot of Potentially unhandled rejection messages even though all of my promises are handling rejections.
ERROR LOG: 'Potentially unhandled rejection [5]
tryCatchReject#http://localhost:9020/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:1252:34
runContinuation1#http://localhost:9020/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:1211:18
when#http://localhost:9020/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:999:20
run#http://localhost:9020/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:1109:28
_drain#http://localhost:9020/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:166:22
drain#http://localhost:9020/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:131:15'
ERROR LOG: 'Potentially unhandled rejection [6]
tryCatchReject#http://localhost:9020/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:1252:34
runContinuation1#http://localhost:9020/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:1211:18
when#http://localhost:9020/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:999:20
run#http://localhost:9020/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:1109:28
_drain#http://localhost:9020/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:166:22
drain#http://localhost:9020/base/jspm_packages/system-polyfills.src.js?3aa57969dce4ecea4c51aab540f372d15cc886b6:131:15'
MyService
✗ should do the thing
Expected 3 to equal 2.
tryCatchReject#/var/www/html/loyaltyone/src/jspm_packages/system-polyfills.src.js:1252:34
runContinuation1#/var/www/html/loyaltyone/src/jspm_packages/system-polyfills.src.js:1211:18
when#/var/www/html/loyaltyone/src/jspm_packages/system-polyfills.src.js:999:20
run#/var/www/html/loyaltyone/src/jspm_packages/system-polyfills.src.js:890:17
PhantomJS 2.1.1 (Linux 0.0.0): Executed 46 of 46 (1 FAILED) (0.205 secs / 0.028 secs)
I there a way to have better trace logs with the errors?
I was seeing the same Potentially unhandled rejection... errors too. They're just awful and completely unhelpful. What I did to debug my issue was to put phantomjs into debug mode, and place a debugger; statement just before the line of code referenced in the error and then I was able to step through and find the exact issue I was having.
In your case, the error is being thrown on line 1252 of jspm_packages/system-polyfills.src.js, at which is a method tryCatchReject. I would place a debugger; statement like so and then view the value of e.message while debugging:
/**
* Return f.call(thisArg, x), or if it throws return a rejected promise for
* the thrown exception
*/
function tryCatchReject(f, x, thisArg, next) {
try {
next.become(getHandler(f.call(thisArg, x)));
} catch(e) {
debugger;
next.become(new Rejected(e));
}
}
The karma-phantomjs-launcher readme gives a good example of how to configure Karma to pass the right flags to phantomjs for debugging as well as some good instructions:
// karma.conf.js
module.exports = function(config) {
config.set({
browsers: ['PhantomJS', 'PhantomJS_custom'],
// you can define custom flags
customLaunchers: {
'PhantomJS_custom': {
base: 'PhantomJS',
options: {
windowName: 'my-window',
settings: {
webSecurityEnabled: false
},
},
flags: ['--load-images=true'],
debug: true
}
},
phantomjsLauncher: {
// Have phantomjs exit if a ResourceError is encountered (useful if karma exits without killing phantom)
exitOnResourceError: true
}
})
}
If you set the debug option to true, you will be instructed to launch
a web browser to bring up the debugger. Note that you will want to put
debugger; statements in your JavaScript to hit breakpoints. You should
be able to put breakpoints in both your test code and your client
code. Note that the debug option automatically adds the
--remote-debugger-port=9000 and --remote-debugger-autorun=yes switches to PhantomJS.
When you start running your tests you should see a prompt to navigate to http://localhost:9000/webkit/inspector/inspector.html?page=2. There you can enabled debugging and step through the code.